summaryrefslogtreecommitdiffstats
path: root/apps/cms.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-03-14 23:30:56 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-03-14 23:30:56 +0000
commitd9f5f07e286bfc7a2a81756199a3e94444e0f6ce (patch)
tree958d67c1dde917f30716dc49cb8405dbae6a89bb /apps/cms.c
parentb31db9ee96c76c964085c09768b3c10cca0c807f (diff)
Initial support for Encrypted Data type generation.
Diffstat (limited to 'apps/cms.c')
-rw-r--r--apps/cms.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/cms.c b/apps/cms.c
index ea538576a3..29e43999e2 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -87,6 +87,7 @@ static int smime_cb(int ok, X509_STORE_CTX *ctx);
#define SMIME_UNCOMPRESS (11 | SMIME_IP)
#define SMIME_COMPRESS (12 | SMIME_OP)
#define SMIME_ENCRYPTED_DECRYPT (13 | SMIME_IP)
+#define SMIME_ENCRYPTED_ENCRYPT (14 | SMIME_OP)
int MAIN(int, char **);
@@ -169,6 +170,8 @@ int MAIN(int argc, char **argv)
operation = SMIME_UNCOMPRESS;
else if (!strcmp (*args, "-EncryptedData_decrypt"))
operation = SMIME_ENCRYPTED_DECRYPT;
+ else if (!strcmp (*args, "-EncryptedData_encrypt"))
+ operation = SMIME_ENCRYPTED_ENCRYPT;
#ifndef OPENSSL_NO_DES
else if (!strcmp (*args, "-des3"))
cipher = EVP_des_ede3_cbc();
@@ -745,6 +748,14 @@ int MAIN(int argc, char **argv)
flags |= CMS_STREAM;
cms = CMS_encrypt(encerts, in, cipher, flags);
}
+ else if (operation == SMIME_ENCRYPTED_ENCRYPT)
+ {
+ if (indef)
+ flags |= CMS_STREAM;
+ cms = CMS_EncryptedData_encrypt(in, cipher,
+ secret_key, secret_keylen,
+ flags);
+ }
else if (operation & SMIME_SIGNERS)
{
int i;