aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_x509.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-05-26 16:09:50 +0200
committerMartin Willi <martin@revosec.ch>2010-05-26 16:09:50 +0200
commitf00a1015904c3718fa6a186d3e5a9b209227d76e (patch)
tree2c27bfc92f867e0bd09402ece85d1340076fc439 /src/libstrongswan/plugins/openssl/openssl_x509.c
parentbd371ccac701b9fea7ca5f26b628dfbfc04cbc8a (diff)
downloadstrongswan-f00a1015904c3718fa6a186d3e5a9b209227d76e.tar.bz2
strongswan-f00a1015904c3718fa6a186d3e5a9b209227d76e.tar.xz
Unwrap subjectKeyIdentifier from OCTET_STRING
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_x509.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_x509.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_x509.c b/src/libstrongswan/plugins/openssl/openssl_x509.c
index 451510584..05b3c63ec 100644
--- a/src/libstrongswan/plugins/openssl/openssl_x509.c
+++ b/src/libstrongswan/plugins/openssl/openssl_x509.c
@@ -666,10 +666,18 @@ static bool parse_authKeyIdentifier_ext(private_openssl_x509_t *this,
static bool parse_subjectKeyIdentifier_ext(private_openssl_x509_t *this,
X509_EXTENSION *ext)
{
- free(this->subjectKeyIdentifier.ptr);
- this->subjectKeyIdentifier = chunk_clone(openssl_asn1_str2chunk(
- X509_EXTENSION_get_data(ext)));
- return TRUE;
+ chunk_t ostr;
+
+ ostr = openssl_asn1_str2chunk(X509_EXTENSION_get_data(ext));
+ /* quick and dirty unwrap of octet string */
+ if (ostr.len > 2 &&
+ ostr.ptr[0] == V_ASN1_OCTET_STRING && ostr.ptr[1] == ostr.len - 2)
+ {
+ free(this->subjectKeyIdentifier.ptr);
+ this->subjectKeyIdentifier = chunk_clone(chunk_skip(ostr, 2));
+ return TRUE;
+ }
+ return FALSE;
}
/**