diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-06-08 00:09:51 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-06-08 00:09:51 +0000 |
commit | 8eb57af5fed7a133cdb2a968081c355249c00b98 (patch) | |
tree | 90c43c1df2e1c3ef81f4c6f4643ba8b561830aad /crypto/pkcs12 | |
parent | 1aad3392e531aa9d32583b435ba4f0b296ee4d27 (diff) |
Complete support for PKCS#5 v2.0. Still needs extensive testing.
Diffstat (limited to 'crypto/pkcs12')
-rw-r--r-- | crypto/pkcs12/p12_add.c | 14 | ||||
-rw-r--r-- | crypto/pkcs12/pkcs12.h | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/crypto/pkcs12/p12_add.c b/crypto/pkcs12/p12_add.c index b5858d1a10..ae3d9de3b4 100644 --- a/crypto/pkcs12/p12_add.c +++ b/crypto/pkcs12/p12_add.c @@ -115,7 +115,8 @@ PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG (int pbe_nid, const char *pass, bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag); if (!(bag->value.shkeybag = - PKCS8_encrypt(pbe_nid, pass, passlen, salt, saltlen, iter, p8))) { + PKCS8_encrypt(pbe_nid, NULL, pass, passlen, salt, saltlen, iter, + p8))) { PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE); return NULL; } @@ -180,9 +181,10 @@ PKCS7 *PKCS12_pack_p7encdata (int pbe_nid, const char *pass, int passlen, return p7; } -X509_SIG *PKCS8_encrypt (int pbe_nid, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - PKCS8_PRIV_KEY_INFO *p8inf) +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8inf) { X509_SIG *p8; X509_ALGOR *pbe; @@ -192,7 +194,9 @@ X509_SIG *PKCS8_encrypt (int pbe_nid, const char *pass, int passlen, return NULL; } - if (!(pbe = PKCS5_pbe_set (pbe_nid, iter, salt, saltlen))) { + if(pbe_nid == -1) pbe = PKCS5_pbe2_set(cipher, iter, salt, saltlen); + else pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen); + if(!pbe) { PKCS12err(PKCS12_F_PKCS8_ENCRYPT, ERR_R_MALLOC_FAILURE); return NULL; } diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h index 1ab91a3c8f..5f3b1148fa 100644 --- a/crypto/pkcs12/pkcs12.h +++ b/crypto/pkcs12/pkcs12.h @@ -197,7 +197,8 @@ ASN1_seq_unpack((p12)->authsafes->d.data->data, \ PKCS12_SAFEBAG *PKCS12_pack_safebag(char *obj, int (*i2d)(), int nid1, int nid2); PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); -X509_SIG *PKCS8_encrypt(int pbe_nid, const char *pass, int passlen, +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, unsigned char *salt, int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, |