OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* | 5 /* |
6 * PKCS7 decoding, verification. | 6 * PKCS7 decoding, verification. |
7 * | 7 * |
8 * $Id: p7decode.c,v 1.30 2012/11/27 22:48:08 bsmith%mozilla.com Exp $ | 8 * $Id: p7decode.c,v 1.31 2012/12/12 19:25:36 wtc%google.com Exp $ |
9 */ | 9 */ |
10 | 10 |
11 #include "p7local.h" | 11 #include "p7local.h" |
12 | 12 |
13 #include "cert.h" | 13 #include "cert.h" |
14 /* XXX do not want to have to include */ | 14 /* XXX do not want to have to include */ |
15 #include "certdb.h" /* certdb.h -- the trust stuff needed by */ | 15 #include "certdb.h" /* certdb.h -- the trust stuff needed by */ |
16 /* the add certificate code needs to get */ | 16 /* the add certificate code needs to get */ |
17 /* rewritten/abstracted and then this */ | 17 /* rewritten/abstracted and then this */ |
18 /* include should be removed! */ | 18 /* include should be removed! */ |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 sec_pkcs7_decoder_get_recipient_key (SEC_PKCS7DecoderContext *p7dcx, | 400 sec_pkcs7_decoder_get_recipient_key (SEC_PKCS7DecoderContext *p7dcx, |
401 SEC_PKCS7RecipientInfo **recipientinfos, | 401 SEC_PKCS7RecipientInfo **recipientinfos, |
402 SEC_PKCS7EncryptedContentInfo *enccinfo) | 402 SEC_PKCS7EncryptedContentInfo *enccinfo) |
403 { | 403 { |
404 SEC_PKCS7RecipientInfo *ri; | 404 SEC_PKCS7RecipientInfo *ri; |
405 CERTCertificate *cert = NULL; | 405 CERTCertificate *cert = NULL; |
406 SECKEYPrivateKey *privkey = NULL; | 406 SECKEYPrivateKey *privkey = NULL; |
407 PK11SymKey *bulkkey = NULL; | 407 PK11SymKey *bulkkey = NULL; |
408 SECOidTag keyalgtag, bulkalgtag, encalgtag; | 408 SECOidTag keyalgtag, bulkalgtag, encalgtag; |
409 PK11SlotInfo *slot = NULL; | 409 PK11SlotInfo *slot = NULL; |
410 int bulkLength = 0; | |
411 | 410 |
412 if (recipientinfos == NULL || recipientinfos[0] == NULL) { | 411 if (recipientinfos == NULL || recipientinfos[0] == NULL) { |
413 p7dcx->error = SEC_ERROR_NOT_A_RECIPIENT; | 412 p7dcx->error = SEC_ERROR_NOT_A_RECIPIENT; |
414 goto no_key_found; | 413 goto no_key_found; |
415 } | 414 } |
416 | 415 |
417 cert = PK11_FindCertAndKeyByRecipientList(&slot,recipientinfos,&ri, | 416 cert = PK11_FindCertAndKeyByRecipientList(&slot,recipientinfos,&ri, |
418 &privkey, p7dcx->pwfn_arg); | 417 &privkey, p7dcx->pwfn_arg); |
419 if (cert == NULL) { | 418 if (cert == NULL) { |
420 p7dcx->error = SEC_ERROR_NOT_A_RECIPIENT; | 419 p7dcx->error = SEC_ERROR_NOT_A_RECIPIENT; |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 /* | 1900 /* |
1902 * No signature, or more than one, means no deal. | 1901 * No signature, or more than one, means no deal. |
1903 */ | 1902 */ |
1904 if (signerinfos == NULL || signerinfos[0] == NULL || signerinfos[1] != NULL) | 1903 if (signerinfos == NULL || signerinfos[0] == NULL || signerinfos[1] != NULL) |
1905 return NULL; | 1904 return NULL; |
1906 | 1905 |
1907 attr = sec_PKCS7FindAttribute (signerinfos[0]->authAttr, | 1906 attr = sec_PKCS7FindAttribute (signerinfos[0]->authAttr, |
1908 SEC_OID_PKCS9_SIGNING_TIME, PR_TRUE); | 1907 SEC_OID_PKCS9_SIGNING_TIME, PR_TRUE); |
1909 return sec_PKCS7AttributeValue (attr); | 1908 return sec_PKCS7AttributeValue (attr); |
1910 } | 1909 } |
OLD | NEW |