<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>I'm reading the book "Network Security with OpenSSL" published by O'Reilly at the moment.<br></div>I'm following the example program and trying to establish a connection between a server and a client.<br></div>I did the following to create my certificates:<br></div><div><br></div><div>To create the root CA:<br></div>$ openssl req -newkey rsa:1024 -sha1 -nodes -keyout rootkey.pem -out rootreq.pem<br>$ openssl x509 -req -in rootreq.pem -sha1 -extensions v3_ca -signkey rootkey.pem -out rootcert.pem<br>$ cat rootcert.pem rootkey.pem > root.pem<br><br></div>To create the server CA and sign it with the root CA:<br>$ openssl req -newkey rsa:1024 -sha1 -nodes -keyout serverCAkey.pem -out serverCAreq.pem<br>$ openssl x509 -req -in serverCAreq.pem -sha1 -extensions v3_ca -CA root.pem -CAkey root.pem -CAcreateserial -out serverCAcert.pem<br>$ cat serverCAcert.pem serverCAkey.pem rootcert.pem > serverCA.pem<br><br></div>To create the server's certificate and sign it with the Server CA:<br>$ openssl req -newkey rsa:1024 -sha1 -nodes -keyout serverkey.pem -out serverreq.pem<br>$ openssl x509 -req -in serverreq.pem -sha1 -extensions usr_cert -CA serverCA.pem -CAkey serverCA.pem -CAcreateserial -out servercert.pem<br>$ cat servercert.pem serverkey.pem serverCAcert.pem rootcert.pem > server.pem<br><br></div>Which means I have the following certificate chain:<br></div>root.pem -> serverCA.pem -> server.pem<br><br></div>But when I try to make a connection I see following error at the client side:<br>Error with certificate at depth: 1<br>issuer  = /C=XX/ST=XX/L=test/O=Testorganisation/CN=Root CA<br>subject = /C=XX/ST=XX/L=test/O=Testorganisation/CN=Server CA<br>err 24:invalid CA certificate<br><br></div>I get the same error with this command:<br>$ openssl verify -CAfile root.pem -untrusted serverCA.pem server.pem<br>server.pem: C = XX, ST = XX, L = test, O = Testorganisation, CN = Server CA<br>error 24 at 1 depth lookup:invalid CA certificate<br>OK<br><br></div>When I sign my server certificate directly with the root CA and leave the server CA out everything works fine.<br><br></div>Did I do something wrong creating the certificates? Or where could the problem be?<br><br></div>Best Regards<br></div>Pascal Withopf<br></div>