aboutsummaryrefslogtreecommitdiffstats
path: root/apps/cms.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-03-19 19:34:30 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-03-19 19:34:30 +0000
commit054307e7ed58b53f36e4dd28066b8f7c4315dfd7 (patch)
tree74d232f1d9ee2496c5c952dfd666cd43de4431c5 /apps/cms.c
parent8cd358bef8c818916d32e4aed0a46d4e14f3a202 (diff)
downloadopenssl-054307e7ed58b53f36e4dd28066b8f7c4315dfd7.tar.gz
Allow alternate eContentType oids to be set in cms utility.
Add id-ct-asciiTextWithCRLF OID. Give more meaninful error message is attempt to use key ID from a certificate without a key ID.
Diffstat (limited to 'apps/cms.c')
-rw-r--r--apps/cms.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/cms.c b/apps/cms.c
index 2cbd43b2a6..70847d90b7 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -125,6 +125,8 @@ int MAIN(int argc, char **argv)
unsigned char *secret_key = NULL, *secret_keyid = NULL;
size_t secret_keylen = 0, secret_keyidlen = 0;
+ ASN1_OBJECT *econtent_type = NULL;
+
X509_VERIFY_PARAM *vpm = NULL;
args = argv + 1;
@@ -268,6 +270,18 @@ int MAIN(int argc, char **argv)
}
secret_keyidlen = (size_t)ltmp;
}
+ else if (!strcmp(*args,"-econtent_type"))
+ {
+ if (!args[1])
+ goto argerr;
+ args++;
+ econtent_type = OBJ_txt2obj(*args, 0);
+ if (!econtent_type)
+ {
+ BIO_printf(bio_err, "Invalid OID %s\n", *args);
+ goto argerr;
+ }
+ }
else if (!strcmp(*args,"-rand"))
{
if (!args[1])
@@ -797,6 +811,8 @@ int MAIN(int argc, char **argv)
}
flags |= CMS_PARTIAL;
cms = CMS_sign(NULL, NULL, other, in, flags);
+ if (econtent_type)
+ CMS_set1_eContentType(cms, econtent_type);
if (!cms)
goto end;
}
@@ -965,6 +981,8 @@ end:
OPENSSL_free(secret_key);
if (secret_keyid)
OPENSSL_free(secret_keyid);
+ if (econtent_type)
+ ASN1_OBJECT_free(econtent_type);
X509_STORE_free(store);
X509_free(cert);
X509_free(recip);