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 implementation -- the exported parts that are used whether | 6 * PKCS7 implementation -- the exported parts that are used whether |
7 * creating or decoding. | 7 * creating or decoding. |
8 */ | 8 */ |
9 | 9 |
10 #include "p7local.h" | 10 #include "p7local.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 * | 395 * |
396 * key is the key with which to perform the encryption. if the | 396 * key is the key with which to perform the encryption. if the |
397 * algorithm is a password based encryption algorithm, the | 397 * algorithm is a password based encryption algorithm, the |
398 * key is actually a password which will be processed per | 398 * key is actually a password which will be processed per |
399 * PKCS #5. | 399 * PKCS #5. |
400 * | 400 * |
401 * in the event of an error, SECFailure is returned. SECSuccess | 401 * in the event of an error, SECFailure is returned. SECSuccess |
402 * indicates a success. | 402 * indicates a success. |
403 */ | 403 */ |
404 SECStatus | 404 SECStatus |
405 SEC_PKCS7EncryptContents(PRArenaPool *poolp, | 405 SEC_PKCS7EncryptContents(PLArenaPool *poolp, |
406 SEC_PKCS7ContentInfo *cinfo, | 406 SEC_PKCS7ContentInfo *cinfo, |
407 SECItem *key, | 407 SECItem *key, |
408 void *wincx) | 408 void *wincx) |
409 { | 409 { |
410 SECAlgorithmID *algid = NULL; | 410 SECAlgorithmID *algid = NULL; |
411 SECItem * result = NULL; | 411 SECItem * result = NULL; |
412 SECItem * src; | 412 SECItem * src; |
413 SECItem * dest; | 413 SECItem * dest; |
414 SECItem * blocked_data = NULL; | 414 SECItem * blocked_data = NULL; |
415 void * mark; | 415 void * mark; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 * | 552 * |
553 * key is the key with which to perform the decryption. if the | 553 * key is the key with which to perform the decryption. if the |
554 * algorithm is a password based encryption algorithm, the | 554 * algorithm is a password based encryption algorithm, the |
555 * key is actually a password which will be processed per | 555 * key is actually a password which will be processed per |
556 * PKCS #5. | 556 * PKCS #5. |
557 * | 557 * |
558 * in the event of an error, SECFailure is returned. SECSuccess | 558 * in the event of an error, SECFailure is returned. SECSuccess |
559 * indicates a success. | 559 * indicates a success. |
560 */ | 560 */ |
561 SECStatus | 561 SECStatus |
562 SEC_PKCS7DecryptContents(PRArenaPool *poolp, | 562 SEC_PKCS7DecryptContents(PLArenaPool *poolp, |
563 SEC_PKCS7ContentInfo *cinfo, | 563 SEC_PKCS7ContentInfo *cinfo, |
564 SECItem *key, | 564 SECItem *key, |
565 void *wincx) | 565 void *wincx) |
566 { | 566 { |
567 SECAlgorithmID *algid = NULL; | 567 SECAlgorithmID *algid = NULL; |
568 SECStatus rv = SECFailure; | 568 SECStatus rv = SECFailure; |
569 SECItem *result = NULL, *dest, *src; | 569 SECItem *result = NULL, *dest, *src; |
570 void *mark; | 570 void *mark; |
571 | 571 |
572 PK11SymKey *eKey = NULL; | 572 PK11SymKey *eKey = NULL; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 682 |
683 int | 683 int |
684 SEC_PKCS7GetKeyLength(SEC_PKCS7ContentInfo *cinfo) | 684 SEC_PKCS7GetKeyLength(SEC_PKCS7ContentInfo *cinfo) |
685 { | 685 { |
686 if (cinfo->contentTypeTag->offset == SEC_OID_PKCS7_ENVELOPED_DATA) | 686 if (cinfo->contentTypeTag->offset == SEC_OID_PKCS7_ENVELOPED_DATA) |
687 return cinfo->content.envelopedData->encContentInfo.keysize; | 687 return cinfo->content.envelopedData->encContentInfo.keysize; |
688 else | 688 else |
689 return 0; | 689 return 0; |
690 } | 690 } |
691 | 691 |
OLD | NEW |