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 encoding. | 6 * PKCS7 encoding. |
7 */ | 7 */ |
8 | 8 |
9 #include "p7local.h" | 9 #include "p7local.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 { | 54 { |
55 SECOidTag kind; | 55 SECOidTag kind; |
56 sec_PKCS7CipherObject *encryptobj; | 56 sec_PKCS7CipherObject *encryptobj; |
57 SEC_PKCS7RecipientInfo **recipientinfos, *ri; | 57 SEC_PKCS7RecipientInfo **recipientinfos, *ri; |
58 SEC_PKCS7EncryptedContentInfo *enccinfo; | 58 SEC_PKCS7EncryptedContentInfo *enccinfo; |
59 SECKEYPublicKey *publickey = NULL; | 59 SECKEYPublicKey *publickey = NULL; |
60 SECKEYPrivateKey *ourPrivKey = NULL; | 60 SECKEYPrivateKey *ourPrivKey = NULL; |
61 PK11SymKey *bulkkey; | 61 PK11SymKey *bulkkey; |
62 void *mark, *wincx; | 62 void *mark, *wincx; |
63 int i; | 63 int i; |
64 PRArenaPool *arena = NULL; | 64 PLArenaPool *arena = NULL; |
65 | 65 |
66 /* Get the context in case we need it below. */ | 66 /* Get the context in case we need it below. */ |
67 wincx = cinfo->pwfn_arg; | 67 wincx = cinfo->pwfn_arg; |
68 | 68 |
69 kind = SEC_PKCS7ContentType (cinfo); | 69 kind = SEC_PKCS7ContentType (cinfo); |
70 switch (kind) { | 70 switch (kind) { |
71 default: | 71 default: |
72 case SEC_OID_PKCS7_DATA: | 72 case SEC_OID_PKCS7_DATA: |
73 case SEC_OID_PKCS7_DIGESTED_DATA: | 73 case SEC_OID_PKCS7_DIGESTED_DATA: |
74 case SEC_OID_PKCS7_SIGNED_DATA: | 74 case SEC_OID_PKCS7_SIGNED_DATA: |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 sec_pkcs7_encoder_sig_and_certs (SEC_PKCS7ContentInfo *cinfo, | 654 sec_pkcs7_encoder_sig_and_certs (SEC_PKCS7ContentInfo *cinfo, |
655 SECKEYGetPasswordKey pwfn, void *pwfnarg) | 655 SECKEYGetPasswordKey pwfn, void *pwfnarg) |
656 { | 656 { |
657 SECOidTag kind; | 657 SECOidTag kind; |
658 CERTCertificate **certs; | 658 CERTCertificate **certs; |
659 CERTCertificateList **certlists; | 659 CERTCertificateList **certlists; |
660 SECAlgorithmID **digestalgs; | 660 SECAlgorithmID **digestalgs; |
661 SECItem **digests; | 661 SECItem **digests; |
662 SEC_PKCS7SignerInfo *signerinfo, **signerinfos; | 662 SEC_PKCS7SignerInfo *signerinfo, **signerinfos; |
663 SECItem **rawcerts, ***rawcertsp; | 663 SECItem **rawcerts, ***rawcertsp; |
664 PRArenaPool *poolp; | 664 PLArenaPool *poolp; |
665 int certcount; | 665 int certcount; |
666 int ci, cli, rci, si; | 666 int ci, cli, rci, si; |
667 | 667 |
668 kind = SEC_PKCS7ContentType (cinfo); | 668 kind = SEC_PKCS7ContentType (cinfo); |
669 switch (kind) { | 669 switch (kind) { |
670 default: | 670 default: |
671 case SEC_OID_PKCS7_DATA: | 671 case SEC_OID_PKCS7_DATA: |
672 case SEC_OID_PKCS7_DIGESTED_DATA: | 672 case SEC_OID_PKCS7_DIGESTED_DATA: |
673 case SEC_OID_PKCS7_ENCRYPTED_DATA: | 673 case SEC_OID_PKCS7_ENCRYPTED_DATA: |
674 case SEC_OID_PKCS7_ENVELOPED_DATA: | 674 case SEC_OID_PKCS7_ENVELOPED_DATA: |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 * be generated internally (usually the case for EnvelopedData but never | 1085 * be generated internally (usually the case for EnvelopedData but never |
1086 * for EncryptedData, which *must* provide a bulk encryption key). | 1086 * for EncryptedData, which *must* provide a bulk encryption key). |
1087 * | 1087 * |
1088 * "pwfn" is a callback for getting the password which protects the | 1088 * "pwfn" is a callback for getting the password which protects the |
1089 * private key of the signer. This argument can be NULL if it is known | 1089 * private key of the signer. This argument can be NULL if it is known |
1090 * that no signing is going to be done. | 1090 * that no signing is going to be done. |
1091 * | 1091 * |
1092 * "pwfnarg" is an opaque argument to the above callback. | 1092 * "pwfnarg" is an opaque argument to the above callback. |
1093 */ | 1093 */ |
1094 SECItem * | 1094 SECItem * |
1095 SEC_PKCS7EncodeItem (PRArenaPool *pool, | 1095 SEC_PKCS7EncodeItem (PLArenaPool *pool, |
1096 SECItem *dest, | 1096 SECItem *dest, |
1097 SEC_PKCS7ContentInfo *cinfo, | 1097 SEC_PKCS7ContentInfo *cinfo, |
1098 PK11SymKey *bulkkey, | 1098 PK11SymKey *bulkkey, |
1099 SECKEYGetPasswordKey pwfn, | 1099 SECKEYGetPasswordKey pwfn, |
1100 void *pwfnarg) | 1100 void *pwfnarg) |
1101 { | 1101 { |
1102 SECStatus rv; | 1102 SECStatus rv; |
1103 | 1103 |
1104 rv = SEC_PKCS7PrepareForEncode (cinfo, bulkkey, pwfn, pwfnarg); | 1104 rv = SEC_PKCS7PrepareForEncode (cinfo, bulkkey, pwfn, pwfnarg); |
1105 if (rv != SECSuccess) | 1105 if (rv != SECSuccess) |
1106 return NULL; | 1106 return NULL; |
1107 | 1107 |
1108 return SEC_ASN1EncodeItem (pool, dest, cinfo, sec_PKCS7ContentInfoTemplate); | 1108 return SEC_ASN1EncodeItem (pool, dest, cinfo, sec_PKCS7ContentInfoTemplate); |
1109 } | 1109 } |
1110 | 1110 |
OLD | NEW |