Differences between NSS and OpenSSL X.509v3 Certificates#
NSS and OpenSSL X509 Certificates can be stored in the Base-64 encoded format. The only difference is between the accepted header and footer required by OpenSSL versus NSS X509 Certificates†.
† - The Dogtag tool called PrettyPrintCert is located in the pki-java-tools package. The PrettyPrintCert tool, as well as some versions of openssl, read both formats without the need for any conversion. Additionally, the NSS tool called pp can be used to read either format.
NSS X509 Certificates#
The following is an example of an NSS Certificate:
Store this certificate in a file called cert.txt.
OpenSSL X509 Certificates#
The following is an example of an OpenSSL Certificate:
Store this certificate in a file called cert.pem.
Using Dogtag to Read X509 Certificates#
Most Dogtag Certificate System installations include the following tool to read an NSS Certificate:
`` ````PrettyPrintCert cert.txt``
Alternatively, a user can execute the following to read an OpenSSL Certificate:
`` ````PrettyPrintCert cert.pem``
In either case, this tool outputs something similar to the following:
Using NSS to Read X509 Certificates#
The following NSS command can also be executed to read an NSS certificate:
``/usr/<lib>/nss/unsupported-tools/pp -t certificate -i cert.txt -a``
where <lib> is either lib on 32-bit architectures, or lib64 on 64-bit architectures.
Alternatively, a user can execute the following to read an OpenSSL certificate:
``/usr/<lib>/nss/unsupported-tools/pp -t certificate -i cert.pem -a``
where <lib> is either lib on 32-bit architectures, or lib64 on 64-bit architectures.
In either case, this tool outputs something similar to the following:
\ ```http://ipa-pki-demo.usersys.redhat.com:9080/ca/ocsp
<http://ipa-pki-demo.usersys.redhat.com:9080/ca/ocsp>`__"
Using OpenSSL to Read and Convert X509 Certificates#
Similarly, running the following OpenSSL command:
`` ````openssl x509 -in cert.pem -noout -text``
Produces the following:
\ ```http://ipa-pki-demo.usersys.redhat.com:9080/ca/ocsp
<http://ipa-pki-demo.usersys.redhat.com:9080/ca/ocsp>`__Convert a PEM certificate to binary (DER encoded) format:
`` ````openssl x509 -in cert.pem -out cert.der -outform DER``
Print out the textual version of a binary (DER encoded) certificate. This command yields the same output as above:
`` ````openssl x509 -in cert.der -inform DER -noout -text``
Convert a binary (DER encoded) certificate to PEM format:
`` ````openssl x509 -in cert.der -inform DER -out cert.pem``