version 1.11, 2022/01/11 14:23:05 |
version 1.12, 2022/01/11 14:35:14 |
|
|
#include <openssl/x509_vfy.h> |
#include <openssl/x509_vfy.h> |
#include <openssl/x509v3.h> |
#include <openssl/x509v3.h> |
|
|
static int save_certs(char *signerfile, STACK_OF(X509) * signers); |
static int save_certs(char *signerfile, STACK_OF(X509) *signers); |
static int smime_cb(int ok, X509_STORE_CTX * ctx); |
static int smime_cb(int ok, X509_STORE_CTX *ctx); |
|
|
#define SMIME_OP 0x10 |
#define SMIME_OP 0x10 |
#define SMIME_IP 0x20 |
#define SMIME_IP 0x20 |
|
|
X509_STORE *store = NULL; |
X509_STORE *store = NULL; |
X509 *cert = NULL, *recip = NULL, *signer = NULL; |
X509 *cert = NULL, *recip = NULL, *signer = NULL; |
EVP_PKEY *key = NULL; |
EVP_PKEY *key = NULL; |
STACK_OF(X509) * encerts = NULL, *other = NULL; |
STACK_OF(X509) *encerts = NULL, *other = NULL; |
BIO *in = NULL, *out = NULL, *indata = NULL; |
BIO *in = NULL, *out = NULL, *indata = NULL; |
int badarg = 0; |
int badarg = 0; |
char *passin = NULL; |
char *passin = NULL; |
|
|
goto end; |
goto end; |
} |
} |
} else if (smime_config.operation == SMIME_VERIFY) { |
} else if (smime_config.operation == SMIME_VERIFY) { |
STACK_OF(X509) * signers; |
STACK_OF(X509) *signers; |
if (PKCS7_verify(p7, other, store, indata, out, smime_config.flags)) |
if (PKCS7_verify(p7, other, store, indata, out, smime_config.flags)) |
BIO_printf(bio_err, "Verification successful\n"); |
BIO_printf(bio_err, "Verification successful\n"); |
else { |
else { |
|
|
} |
} |
|
|
static int |
static int |
save_certs(char *signerfile, STACK_OF(X509) * signers) |
save_certs(char *signerfile, STACK_OF(X509) *signers) |
{ |
{ |
int i; |
int i; |
BIO *tmp; |
BIO *tmp; |
|
|
if (!signerfile) |
if (!signerfile) |
return 1; |
return 1; |
tmp = BIO_new_file(signerfile, "w"); |
tmp = BIO_new_file(signerfile, "w"); |
|
|
for (i = 0; i < sk_X509_num(signers); i++) |
for (i = 0; i < sk_X509_num(signers); i++) |
PEM_write_bio_X509(tmp, sk_X509_value(signers, i)); |
PEM_write_bio_X509(tmp, sk_X509_value(signers, i)); |
BIO_free(tmp); |
BIO_free(tmp); |
|
|
return 1; |
return 1; |
} |
} |
|
|
|
|
/* Minimal callback just to output policy info (if any) */ |
/* Minimal callback just to output policy info (if any) */ |
|
|
static int |
static int |
smime_cb(int ok, X509_STORE_CTX * ctx) |
smime_cb(int ok, X509_STORE_CTX *ctx) |
{ |
{ |
int error; |
int error; |
|
|
|
|
policies_print(NULL, ctx); |
policies_print(NULL, ctx); |
|
|
return ok; |
return ok; |
|
|
} |
} |
|
|