_hx509_pbe_decrypt now takes a hx509_lock.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16028 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-09-04 15:16:46 +00:00
parent 1479736a8f
commit 50f29f80b1
2 changed files with 9 additions and 26 deletions

View File

@@ -890,10 +890,9 @@ hx509_cms_decrypt_encrypted(hx509_lock lock,
heim_octet_string *content) heim_octet_string *content)
{ {
heim_octet_string cont; heim_octet_string cont;
const struct _hx509_password *pw;
CMSEncryptedData ed; CMSEncryptedData ed;
AlgorithmIdentifier *ai; AlgorithmIdentifier *ai;
int ret, i; int ret;
memset(content, 0, sizeof(*content)); memset(content, 0, sizeof(*content));
memset(&cont, 0, sizeof(cont)); memset(&cont, 0, sizeof(cont));
@@ -917,17 +916,10 @@ hx509_cms_decrypt_encrypted(hx509_lock lock,
goto out; goto out;
} }
pw = _hx509_lock_get_passwords(lock); ret = _hx509_pbe_decrypt(lock,
ret = HX509_CRYPTO_INTERNAL_ERROR;
for (i = 0; i < pw->len; i++) {
ret = _hx509_pbe_decrypt(pw->val[i],
ai, ai,
ed.encryptedContentInfo.encryptedContent, ed.encryptedContentInfo.encryptedContent,
&cont); &cont);
if (ret == 0)
break;
}
if (ret) if (ret)
goto out; goto out;

View File

@@ -88,8 +88,6 @@ ShroudedKeyBag_parser(struct collector *c, const void *data, size_t length,
PKCS8EncryptedPrivateKeyInfo pk; PKCS8EncryptedPrivateKeyInfo pk;
PKCS8PrivateKeyInfo ki; PKCS8PrivateKeyInfo ki;
heim_octet_string content; heim_octet_string content;
const struct _hx509_password *pw;
int i;
int ret; int ret;
printf("pkcs8ShroudedKeyBag\n"); printf("pkcs8ShroudedKeyBag\n");
@@ -107,17 +105,10 @@ ShroudedKeyBag_parser(struct collector *c, const void *data, size_t length,
return ret; return ret;
} }
pw = _hx509_lock_get_passwords(c->lock); ret = _hx509_pbe_decrypt(c->lock,
ret = HX509_CRYPTO_INTERNAL_ERROR;
for (i = 0; i < pw->len; i++) {
ret = _hx509_pbe_decrypt(pw->val[i],
&pk.encryptionAlgorithm, &pk.encryptionAlgorithm,
&pk.encryptedData, &pk.encryptedData,
&content); &content);
if (ret == 0)
break;
}
free_PKCS8EncryptedPrivateKeyInfo(&pk); free_PKCS8EncryptedPrivateKeyInfo(&pk);
if (ret) { if (ret) {
printf("decrypt encryped failed %d\n", ret); printf("decrypt encryped failed %d\n", ret);