diff options
author | Martin Willi <martin@strongswan.org> | 2008-05-06 12:56:36 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-05-06 12:56:36 +0000 |
commit | c963c4bc15c951f62a1c76dfb3dc2c841ecfd09c (patch) | |
tree | 4630110ec8eb467fb32ec06d8ceb4f38efa721d4 /src/libstrongswan/plugins/gmp/gmp_public_key.c | |
parent | ff6836716c1bacbca74bce6965a11523d35fab66 (diff) | |
download | strongswan-c963c4bc15c951f62a1c76dfb3dc2c841ecfd09c.tar.bz2 strongswan-c963c4bc15c951f62a1c76dfb3dc2c841ecfd09c.tar.xz |
fixed parsing of openssl format public keys
Diffstat (limited to 'src/libstrongswan/plugins/gmp/gmp_public_key.c')
-rw-r--r-- | src/libstrongswan/plugins/gmp/gmp_public_key.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libstrongswan/plugins/gmp/gmp_public_key.c b/src/libstrongswan/plugins/gmp/gmp_public_key.c index 37a079ae3..4105f58be 100644 --- a/src/libstrongswan/plugins/gmp/gmp_public_key.c +++ b/src/libstrongswan/plugins/gmp/gmp_public_key.c @@ -29,7 +29,7 @@ static const asn1Object_t pkinfoObjects[] = { { 0, "subjectPublicKeyInfo",ASN1_SEQUENCE, ASN1_NONE }, /* 0 */ { 1, "algorithm", ASN1_EOC, ASN1_RAW }, /* 1 */ - { 1, "subjectPublicKey", ASN1_BIT_STRING, ASN1_OBJ }, /* 2 */ + { 1, "subjectPublicKey", ASN1_BIT_STRING, ASN1_BODY }, /* 2 */ { 0, "exit", ASN1_EOC, ASN1_EXIT } }; #define PKINFO_SUBJECT_PUBLIC_KEY_ALGORITHM 1 @@ -73,13 +73,11 @@ static public_key_t *load(chunk_t blob) if (object.len > 0 && *object.ptr == 0x00) { /* skip initial bit string octet defining 0 unused bits */ - object.ptr++; - object.len--; - key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, type, - BUILD_BLOB_ASN1_DER, - chunk_clone(object), - BUILD_END); + object = chunk_skip(object, 1); } + key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, type, + BUILD_BLOB_ASN1_DER, chunk_clone(object), + BUILD_END); break; } } |