maroph

OpenSSL: Create key pair and a self-signed certificate

Sep 30th, 2016
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | None | 0 0
  1. # Create a RSA 2048 bit public/private key pair and a self-signed certificate
  2. # Certificate: public key data plus meta data (expiration date, -sub parameters, signature algorithm sha256WithRSAEncryption)
  3. openssl req -new -x509 -nodes -newkey rsa:2048 -days 365 -keyout server.key -out server.crt -sha256 -subj "/C=DE/ST=Bavaria/L=Munich/OU=MyDepartment/O=MyCompany/CN=server"
  4. # public/private key are stored in file server.key and the certificate in file server.crt
  5. #
  6. # Pack the data in a PKCS12 key store
  7. # Key store password: 123456
  8. openssl pkcs12 -export -in server.crt -inkey server.key -name server -out server.p12 -passout pass:123456
  9. #
  10. # No key store password
  11. openssl pkcs12 -export -in server.crt -inkey server.key -name server -out server.p12 -passout pass:
Advertisement
Add Comment
Please, Sign In to add comment