Search code examples
ssl-certificatekeytoolcsr

Add e-mail to CSR generated with keytool


As per this : http://en.wikipedia.org/wiki/Certificate_signing_request the CSR can contain an email address.

My question is how can I add such e-mail address field considering I`m generating the CSR with keytool ?

Thank you.


Solution

  • When generating the key pair you can pass the Distinguished Name as a parameter with the -dname flag and thus add the EMAILADDRESS attribute.

    keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048 -dname "CN=Your Name, [email protected], C=UK"