title: How do I create an X509 Key Bundle using openssl?
body: <p><strong>What is an issue:</strong></p>
  
  <p>I am not sure about the way that I create/validation of an X509 Key Bundle.</p>
  
  <p><strong>What I have done?</strong></p>
  
  <p>I am trying to create an X509 mutual authentication key bundle using OpenSSL,  able to generate the certificate and Key Bundle. The following script is used to create the bundle.</p>
  
  <pre><code>mkdir certificate
  cd certificate
  mkdir certs csr newcerts
  touch index.txt
  echo "1000" &gt; serial
  
  ::Root Certicicate
  openssl genrsa -out certs/ca.key.pem 2048
  openssl req -config openssl.cnf -key certs/ca.key.pem -new -x509 -days 3650 -sha256 -extensions v3_ca -out certs/ca.crt.pem
  openssl x509 -noout -text -in certs/ca.crt.pem
  openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
  
  ::Certificate 1
  openssl genrsa -out certs/intermediate1.key.pem 2048
  openssl genpkey -algorithm RSA -out certs/intermediate1.key.pem 2048
  openssl req -config openssl.cnf -key certs/intermediate1.key.pem -new -sha256 -out csr/intermediate1.csr.pem -subj "/C=CN/ST=STATE/O=ORG/CN=intermediate1"
  openssl ca -config openssl.cnf -batch -extensions usr_cert -days 3750 -notext -md sha256 -in csr/intermediate1.csr.pem -out certs/intermediate1.crt.pem
  
  ::Certificate 2
  openssl genrsa -out certs/intermediate2.key.pem 2048
  openssl genpkey -algorithm RSA -out certs/intermediate2.key.pem 2048
  openssl req -config openssl.cnf -key certs/intermediate2.key.pem -new -sha256 -out csr/intermediate2.csr.pem -subj "/C=CN/ST=STATE/O=ORG/CN=intermediate2"
  openssl ca -config openssl.cnf -batch -extensions usr_cert -days 3750 -notext -md sha256 -in csr/intermediate2.csr.pem -out certs/intermediate2.crt.pem
  
  ::Chain the certificate
  cat certs/intermediate1.crt.pem certs/ca.crt.pem &gt; certs/ca-chain.cert.pem
  cat certs/intermediate2.crt.pem certs/ca.crt.pem &gt; certs/ca-chain.cert.pem
  </code></pre>
  
  <p><strong>How did I validate?</strong></p>
  
  <p>I don't know precisely to validate. Please help in this regard.</p>
  
  <p><strong>What are the other solutions tried?</strong></p>
  
  <p><a href="http://keystore-explorer.org/" rel="nofollow noreferrer">KeyStore Explorer</a></p>
  
  <p><a href="https://stackoverflow.com/questions/30634658/how-to-create-a-certificate-chain-using-keytool">Stackoverflow answers</a></p>
  
  <p><strong>How do forum experts help here?</strong></p>
  
  <p>I am strongly believing that I am circulating around the solution without any conclusion and feels like being stupid. I really need a expert advice to close this in the view of Create Key Bundle/Validate with any public muauth server or any other methods.</p>
  
  <p><strong>ca-chain certificate</strong></p>
  
  <p><a href="https://i.stack.imgur.com/4Ufae.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Ufae.png" alt="enter image description here"></a></p>