summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-05-01 23:30:06 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-05-01 23:30:06 +0000
commit4a954b56c9db99c7644b40630a02865a98123e9c (patch)
tree04cfb39231e7375d31b64409ee638b9c4b4299e6 /apps
parentd05a474556c627a8e87b32d7e97aa776308dc883 (diff)
Use "cont" consistently in cms-examples.pl
Add a -certsout option to output any certificates in a message. Add test for example 4.11
Diffstat (limited to 'apps')
-rw-r--r--apps/cms.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/cms.c b/apps/cms.c
index b1ffb382ad..42bdb69eb2 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -107,6 +107,7 @@ int MAIN(int argc, char **argv)
char *signerfile = NULL, *recipfile = NULL;
STACK *sksigners = NULL, *skkeys = NULL;
char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
+ char *certsoutfile = NULL;
const EVP_CIPHER *cipher = NULL;
CMS_ContentInfo *cms = NULL, *rcms = NULL;
X509_STORE *store = NULL;
@@ -397,6 +398,12 @@ int MAIN(int argc, char **argv)
goto argerr;
recipfile = *++args;
}
+ else if (!strcmp (*args, "-certsout"))
+ {
+ if (!args[1])
+ goto argerr;
+ certsoutfile = *++args;
+ }
else if (!strcmp (*args, "-md"))
{
if (!args[1])
@@ -602,6 +609,7 @@ int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-noattr don't include any signed attributes\n");
BIO_printf (bio_err, "-binary don't translate message to text\n");
BIO_printf (bio_err, "-certfile file other certificates file\n");
+ BIO_printf (bio_err, "-certsout file certificate output file\n");
BIO_printf (bio_err, "-signer file signer certificate file\n");
BIO_printf (bio_err, "-recip file recipient certificate file for decryption\n");
BIO_printf (bio_err, "-skeyid use subject key identifier\n");
@@ -797,6 +805,20 @@ int MAIN(int argc, char **argv)
goto end;
}
}
+ if (certsoutfile)
+ {
+ STACK_OF(X509) *allcerts;
+ allcerts = CMS_get1_certs(cms);
+ if (!save_certs(certsoutfile, allcerts))
+ {
+ BIO_printf(bio_err,
+ "Error writing certs to %s\n",
+ certsoutfile);
+ ret = 5;
+ goto end;
+ }
+ sk_X509_pop_free(allcerts, X509_free);
+ }
}
if (rctfile)