summaryrefslogtreecommitdiffstats
path: root/apps/smime.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-06-02 14:12:07 +0100
committerDr. Stephen Henson <steve@openssl.org>2014-06-02 14:22:07 +0100
commit14f47acf235797be4d59eeb07b151c66b5b0179a (patch)
tree4c9219e112cb9bff0516fa9cda57f066b8ea2d51 /apps/smime.c
parent13b7896022e3b45c229696b6fec086c4c486ec5a (diff)
Allow reordering of certificates when signing.
Add certificates if -nocerts and -certfile specified when signing in smime application. This can be used this to specify the order certificates appear in the PKCS#7 structure: some broken applications require a certain ordering. PR#3316
Diffstat (limited to 'apps/smime.c')
-rw-r--r--apps/smime.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/smime.c b/apps/smime.c
index d1fe32d31b..d1ee48937e 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -704,6 +704,14 @@ int MAIN(int argc, char **argv)
p7 = PKCS7_sign(NULL, NULL, other, in, flags);
if (!p7)
goto end;
+ if (flags & PKCS7_NOCERTS)
+ {
+ for (i = 0; i < sk_X509_num(other); i++)
+ {
+ X509 *x = sk_X509_value(other, i);
+ PKCS7_add_certificate(p7, x);
+ }
+ }
}
else
flags |= PKCS7_REUSE_DIGEST;