HTTPS Misc
JCE
Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
If you need keys that longer than 1024 bits. Unzip the jce
package into $JAVA_HOME/lib/security/
JDK 7
|
|
JDK 8
|
|
File Formats
.pem
Privacy Enhanced Mail, a way of encoding data.
It may contain:
- public key (certificate)
- private key
- CA certificates (root, chain)
- CSR pkcs10 encoded (not common)
.csr
Format of pkcs10, you generate csr and submit it to the CA to generate your certificate.
.key
Private key or public key.
.pkcs12 .pfx .p12
A passworded container format that contains both public and private certificate pairs. Unlike .pem files, this container is fully encrypted.
Openssl can turn this into a .pem file with both public and private keys:
.der
The parent format of PEM. It’s useful to think of it as a binary version of the base64-encoded PEM file. Not routinely used by much outside of Windows.
.cert .cer .crt
A .pem (or rarely .der) formatted file with a different extension, one that is recognized by Windows Explorer as a certificate, which .pem is not.
###
Openssl
Generate a new private key and Certificate Signing Request
Generate a self-signed certificate
Generate a certificate signing request (CSR) for an existing private key
Remove a passphrase from a private key
Convert DER file (.crt .cer .der) to PEM
Convert PEM file to DER
Importing an existing certificate into a PKCS12 keystore
Keytool
Create a keystore file to store the server’s private key and self-signed certificate
Create a CSR based on the keystore
Import the self-signed certificate into JRE’s keystore, so that your Java program can communicate with remote servers that serve https services with that self-signed certificate