APPS/cmp: make the -sans option support email addresses (type rfc822Name)
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Wed, 3 Nov 2021 17:41:07 +0000 (18:41 +0100)
committerDr. David von Oheimb <dev@ddvo.net>
Mon, 8 Nov 2021 06:47:55 +0000 (07:47 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16960)

apps/cmp.c
doc/man1/openssl-cmp.pod.in

index b6e88e64f6db1743dc2af6d527ee8008196c04c5..1c97075531d413ff17d42133c2864d1085191148 100644 (file)
@@ -836,11 +836,12 @@ static int set_gennames(OSSL_CMP_CTX *ctx, char *names, const char *desc)
             continue;
         }
 
-        /* try IP address first, then URI or domain name */
+        /* try IP address first, then email/URI/domain name */
         (void)ERR_set_mark();
         n = a2i_GENERAL_NAME(NULL, NULL, NULL, GEN_IPADD, names, 0);
         if (n == NULL)
             n = a2i_GENERAL_NAME(NULL, NULL, NULL,
+                                 strchr(names, '@') != NULL ? GEN_EMAIL :
                                  strchr(names, ':') != NULL ? GEN_URI : GEN_DNS,
                                  names, 0);
         (void)ERR_pop_to_mark();
index b4c3c822555fcc2f438f16760e84522d20222143..58e9bd7ddad5773870b3069ccbaf044a3f7d9468 100644 (file)
@@ -312,7 +312,8 @@ contained the given PKCS#10 CSR, overriding any extensions with same OIDs.
 
 =item B<-sans> I<spec>
 
-One or more IP addresses, DNS names, or URIs separated by commas or whitespace
+One or more IP addresses, email addresses, DNS names, or URIs
+separated by commas or whitespace
 (where in the latter case the whole argument must be enclosed in "...")
 to add as Subject Alternative Name(s) (SAN) certificate request extension.
 If the special element "critical" is given the SANs are flagged as critical.