diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2005-05-15 00:54:45 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2005-05-15 00:54:45 +0000 |
commit | b6995add5c91e9d62812883d884f0c558e6235d3 (patch) | |
tree | de05b05031f2ddd4848598a1e8e33e0aa3021c06 /crypto/pkcs12/p12_crt.c | |
parent | 8ccd06c66c948916a5a3984087860e297f49051d (diff) |
Make -CSP option work again in pkcs12 utility by checking for
attribute in EVP_PKEY structure.
Diffstat (limited to 'crypto/pkcs12/p12_crt.c')
-rw-r--r-- | crypto/pkcs12/p12_crt.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/pkcs12/p12_crt.c b/crypto/pkcs12/p12_crt.c index 77b5845ea9..dbafda17b6 100644 --- a/crypto/pkcs12/p12_crt.c +++ b/crypto/pkcs12/p12_crt.c @@ -122,9 +122,21 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, if (pkey) { + int cspidx; bag = PKCS12_add_key(&bags, pkey, keytype, iter, nid_key, pass); + if (!bag) goto err; + + cspidx = EVP_PKEY_get_attr_by_NID(pkey, NID_ms_csp_name, -1); + if (cspidx >= 0) + { + X509_ATTRIBUTE *cspattr; + cspattr = EVP_PKEY_get_attr(pkey, cspidx); + if (!X509at_add1_attr(&bag->attrib, cspattr)) + goto err; + } + if(name && !PKCS12_add_friendlyname(bag, name, -1)) goto err; if(keyidlen && !PKCS12_add_localkeyid(bag, keyid, keyidlen)) |