68 static int newpass_p12(
PKCS12 *p12,
char *oldpass,
char *newpass);
71 static int newpass_bag(
PKCS12_SAFEBAG *bag,
char *oldpass,
char *newpass);
72 static int alg_get(
X509_ALGOR *alg,
int *pnid,
int *piter,
int *psaltlen);
94 if (!newpass_p12(p12, oldpass, newpass)) {
104 static int newpass_p12(
PKCS12 *p12,
char *oldpass,
char *newpass)
108 int i, bagnid, pbe_nid = 0, pbe_iter = 0, pbe_saltlen = 0;
114 if (!(asafes = PKCS12_unpack_authsafes(p12)))
return 0;
120 bags = PKCS12_unpack_p7data(p7);
122 bags = PKCS12_unpack_p7encdata(p7, oldpass, -1);
124 &pbe_nid, &pbe_iter, &pbe_saltlen))
127 PKCS12_SAFEBAG_free);
135 if (!newpass_bags(bags, oldpass, newpass)) {
143 pbe_saltlen, pbe_iter, bags);
156 if(!(p12->
authsafes->
d.
data = ASN1_OCTET_STRING_new()))
goto saferr;
160 if(!(macnew = ASN1_OCTET_STRING_new()))
goto saferr;
164 ASN1_OCTET_STRING_free(p12_data_tmp);
171 ASN1_OCTET_STRING_free(macnew);
192 static int newpass_bag(
PKCS12_SAFEBAG *bag,
char *oldpass,
char *newpass)
196 int p8_nid, p8_saltlen, p8_iter;
204 if(!(p8new =
PKCS8_encrypt(p8_nid, NULL, newpass, -1, NULL, p8_saltlen,
205 p8_iter, p8)))
return 0;
211 static int alg_get(
X509_ALGOR *alg,
int *pnid,
int *piter,
int *psaltlen)
214 const unsigned char *
p;