Re: 1.OU or OU.1 ?

2020-03-20 Thread Richard Levitte
The correct answer is, it depends.  This is an unfortunate
evolutionary artefact, and is governed by very different pieces of
code.

The config.pod example revolves around subject names and the config
for 'openssl req'.  The code that uses this is the function
auto_info(), found in apps/req.c.

The x509v3_config.pod example revolves around X.509 v3 extensions, and
the config for those is used by diverse functions in crypto/x509v3/
(1.1.1) or crypto/x509/ (masterand upcoming 3.0), and ultimately, the
key name comparison is done by name_cmp(), found in v3_utl.c.

So both manuals are correct.  Unfortunately...

Cheers,
Richard

On Fri, 20 Mar 2020 22:12:08 +0100,
Salz, Rich via openssl-users wrote:
> 
> 
> The doc/man5/config.pod file says to use
> 
> 1.OU = “My first OU”
> 
> 2.OU = “My second OU”
> 
> But doc/man5/x509v3_config.pod says to append the numeric, as in
> 
> email.1 = steve@here
> 
> email.2 = steve@there
> 
> I believe the second form is correct.  Can anyone confirm?
> 
> 
-- 
Richard Levitte levi...@openssl.org
OpenSSL Project http://www.openssl.org/~levitte/


Re: 1.OU or OU.1 ?

2020-03-20 Thread Dirk-Willem van Gulik



> On 20 Mar 2020, at 22:12, Salz, Rich via openssl-users 
>  wrote:
> 
> The doc/man5/config.pod file says to use
> 1.OU = “My first OU”
> 2.OU = “My second OU”
>  
> But doc/man5/x509v3_config.pod says to append the numeric, as in
> email.1 = steve@here
> email.2 = steve@there
>  
> I believe the second form is correct.  Can anyone confirm?

AFAIK: Either simply like (e.g. in an extension file):

 subjectAltName=email:foo@x,email:bar@x

or more listed like your second form:

[ v3_req ]
subjectAltName = @extrabits

[ extrabits ]
email.1=foo
email.2=foo

or straight (ordered) directly:

openssl req -x509 -subj /CN=foo/CN=bar -keyout /dev/null -nodes| 
openssl x509 -noout -subject  

Dw.





1.OU or OU.1 ?

2020-03-20 Thread Salz, Rich via openssl-users
The doc/man5/config.pod file says to use
1.OU = “My first OU”
2.OU = “My second OU”

But doc/man5/x509v3_config.pod says to append the numeric, as in
email.1 = steve@here
email.2 = steve@there

I believe the second form is correct.  Can anyone confirm?



Re: OpenSSL server sending certificate chain(inc. root cert) during handshake

2020-03-20 Thread Jason Schultz
I apologize for bringing this old subject back up, but I'm running into 
something I wanted to poll the list on.

Based on Victor's email below, I am doing the following in my application to 
set up my server to send a certificate chain *excluding* the root certificate 
during a handshake.

status = SSL_CTX_set_mode(ctx, SSL_MODE_NO_AUTO_CHAIN);
status = SSL_CTX_build_cert_chain(ctx, SSL_BUILD_CHAIN_FLAG_NO_ROOT);

When I configure a certificate chain, the server sends the chain, excluding the 
root. The call to SSL_CTX_build_cert_chain() accomplishes this, with the "no 
root" flag. This works as expected.

The interesting part comes in when I am configuring a self-signed certificate 
as the server cert.

** NOTE **: I know this isn't recommended, this is ONLY for test purposes, and 
our users will configure servers in this way, also ONLY for test purposes. This 
is why I'm testing the operation of this configuration.

As Victor indicated, my EE certificate is also the entire chain; of 1 
self-signed certificate. Setting the SSL_MODE_AUTO_CHAIN flag allowed me to 
configure a self-signed certificate on the server, the two calls above succeed, 
and my server sends that single, self-signed cert in the handshake. This is 
true for version 3 self-signed certificates, with the CA bit set.

If I have a version 1 *RSA* certificate, with the CA bit NOT set(so CA:FALSE), 
the call to SSL_CTX_build_cert_chain() errors. I think this is the expected 
behavior. Does everyone agree with that? Since OpenSSL 1.1.1 is more strict 
regarding the CA bit, the building of the "chain" will fail because a 
self-signed cert MUST have CA:TRUE.

The incorrect behavior I think I'm seeing is when configuring a self-signed 
ECDSA certificate. I'll paste the certificate below, but I would think this 
version 1 certificate that does NOT have CA:TRUE would error in the same was 
the similar RSA certificate did above. Does anyone know what could be the 
result of the (seemingly) different behavior? Are there any other tests I could 
try to lead me to an answer?

Thanks,

Jason


TEST:/etc/ssl # openssl x509 -text -noout -in certs/ecdsacert.pem
Certificate:
Data:
Version: 1 (0x0)
Serial Number:
de:6e:db:59:3a:03:e5:ac
Signature Algorithm: ecdsa-with-SHA256
Issuer: C=US, ST=State, L=City, O=Company, OU=Networking, 
CN=COMMON-NAME/emailAddress=john@example.com
Validity
Not Before: Mar 17 18:23:09 2020 GMT
Not After : Mar 17 18:23:09 2021 GMT
Subject: C=US, ST=State, L=City, O=Company, OU=Networking, 
CN=COMMON-NAME/emailAddress=john@example.com
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
pub:
04:dc:67:d3:f5:53:0b:c9:3c:13:e9:d9:52:17:60:
fb:a2:f6:ad:98:74:a4:1b:6d:57:52:81:d3:e5:8f:
e9:0f:a6:32:81:8f:f6:6d:3f:f2:1c:1c:6b:a7:c6:
3a:59:a3:c8:ce:12:08:ee:5c:8c:3e:4f:52:cb:35:
dc:6b:1a:de:59
ASN1 OID: prime256v1
NIST CURVE: P-256
Signature Algorithm: ecdsa-with-SHA256
 30:45:02:20:66:d8:35:06:98:38:0a:88:57:c4:8d:30:02:97:
 3a:e7:4f:34:4a:50:d2:5c:e7:16:61:80:b3:43:41:7f:71:42:
 02:21:00:82:c2:39:b5:52:d4:e9:aa:21:d5:d1:fb:e8:01:e2:
 aa:81:16:75:cb:0d:2c:33:f6:34:5b:54:80:ac:82:66:4f




From: openssl-users  on behalf of Viktor 
Dukhovni 
Sent: Friday, May 31, 2019 9:44 PM
To: openssl-users@openssl.org 
Subject: Re: OpenSSL server sending certificate chain(inc. root cert) during 
handshake

> On May 31, 2019, at 3:20 PM, Jason Schultz  wrote:
>
> My questions deal with #2: Why does OpenSSL include the root cert in the 
> certificate chain?

The OpenSSL SSL_CTX_build_cert_chain(3) function constructs a complete
chain of trust for your certificate chain, based on the configured trust
stores (CAfile and/or CApath).  If you call this function, then you can
control how your certificates chain is augmented.

But if your EE certificate is the entire chain, then the internal automatic
chain construction code will assume that the chain was not built, and will
try to augment it unless you set the SSL_MODE_NO_AUTO_CHAIN flag via:

  SSL_CTX_set_mode(3), or
  SSL_set_mode(3)

[ Which really ought to also document SSL_MODE_NO_AUTO_CHAIN ]

> Will the root cert be included in the chain any time it's in the same 
> directory
> as the server cert?

No, the chain is augmented based on the configured trust stores, and does
not directly consider the directory holding the chain file.

> Is there a way, via API call, configuration, etc, to force OpenSSL to NOT 
> send the
> root certificate as part of the chain in this case?

You can set a CAfile/CApath that do not include the location of the root
cert, or disable automatic chain construction, and build the chain just
the way you like it 

An idiosyncratic port of OpenSSL 1.1.1e to OS/400 ILE

2020-03-20 Thread Dan Fulger
This port is for ILE (native OS/400) not PASE (PASE is almost like Unix, and 
already comes with openssl).
 
The idiosynchrasies are explained in the README.as400 file in AS400patch.tar.gz.
 
AS400patch.tar.gz (large patch for OpenSSL and other files):
https://drive.google.com/file/d/1XT24UqC5rkPSpCwbFe2CgrTkDCCteEsM/view?usp=sharing

Again, the patch is smaller than the one for 1.1.1d one because EBCDIC fixes in 
1.1.1e duplicated a part of my patch.
 
AS400_GNU.tar.gz (source for GNU/IBM tools required to build openssl in ILE 
environment):
https://drive.google.com/open?id=1DeKIE32nmUpvk7fvrcSYlflUn_k1CBso