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

View File

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