smime.c (79998) | smime.c (100928) |
---|---|
1/* smime.c */ 2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL 3 * project 1999. 4 */ 5/* ==================================================================== 6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 400 unchanged lines hidden (view full) --- 409 } 410 411 ret = 3; 412 413 if(operation == SMIME_ENCRYPT) { 414 p7 = PKCS7_encrypt(encerts, in, cipher, flags); 415 } else if(operation == SMIME_SIGN) { 416 p7 = PKCS7_sign(signer, key, other, in, flags); | 1/* smime.c */ 2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL 3 * project 1999. 4 */ 5/* ==================================================================== 6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 400 unchanged lines hidden (view full) --- 409 } 410 411 ret = 3; 412 413 if(operation == SMIME_ENCRYPT) { 414 p7 = PKCS7_encrypt(encerts, in, cipher, flags); 415 } else if(operation == SMIME_SIGN) { 416 p7 = PKCS7_sign(signer, key, other, in, flags); |
417 BIO_reset(in); | 417 if (BIO_reset(in) != 0 && (flags & PKCS7_DETACHED)) { 418 BIO_printf(bio_err, "Can't rewind input file\n"); 419 goto end; 420 } |
418 } else { 419 if(informat == FORMAT_SMIME) 420 p7 = SMIME_read_PKCS7(in, &indata); 421 else if(informat == FORMAT_PEM) 422 p7 = PEM_read_bio_PKCS7(in, NULL, NULL, NULL); 423 else if(informat == FORMAT_ASN1) 424 p7 = d2i_PKCS7_bio(in, NULL); 425 else { --- 23 unchanged lines hidden (view full) --- 449 if(operation == SMIME_DECRYPT) { 450 if(!PKCS7_decrypt(p7, key, recip, out, flags)) { 451 BIO_printf(bio_err, "Error decrypting PKCS#7 structure\n"); 452 goto end; 453 } 454 } else if(operation == SMIME_VERIFY) { 455 STACK_OF(X509) *signers; 456 if(PKCS7_verify(p7, other, store, indata, out, flags)) { | 421 } else { 422 if(informat == FORMAT_SMIME) 423 p7 = SMIME_read_PKCS7(in, &indata); 424 else if(informat == FORMAT_PEM) 425 p7 = PEM_read_bio_PKCS7(in, NULL, NULL, NULL); 426 else if(informat == FORMAT_ASN1) 427 p7 = d2i_PKCS7_bio(in, NULL); 428 else { --- 23 unchanged lines hidden (view full) --- 452 if(operation == SMIME_DECRYPT) { 453 if(!PKCS7_decrypt(p7, key, recip, out, flags)) { 454 BIO_printf(bio_err, "Error decrypting PKCS#7 structure\n"); 455 goto end; 456 } 457 } else if(operation == SMIME_VERIFY) { 458 STACK_OF(X509) *signers; 459 if(PKCS7_verify(p7, other, store, indata, out, flags)) { |
457 BIO_printf(bio_err, "Verification Successful\n"); | 460 BIO_printf(bio_err, "Verification successful\n"); |
458 } else { | 461 } else { |
459 BIO_printf(bio_err, "Verification Failure\n"); | 462 BIO_printf(bio_err, "Verification failure\n"); |
460 goto end; 461 } 462 signers = PKCS7_get0_signers(p7, other, flags); 463 if(!save_certs(signerfile, signers)) { 464 BIO_printf(bio_err, "Error writing signers to %s\n", 465 signerfile); 466 ret = 5; 467 goto end; --- 82 unchanged lines hidden --- | 463 goto end; 464 } 465 signers = PKCS7_get0_signers(p7, other, flags); 466 if(!save_certs(signerfile, signers)) { 467 BIO_printf(bio_err, "Error writing signers to %s\n", 468 signerfile); 469 ret = 5; 470 goto end; --- 82 unchanged lines hidden --- |