Javadoc
Decode a PKCS #8 encoded private key. OpenSSL, for instance, does not put out this format
automatically. The standard command will generate a PEM file, e.g.,
openssl genrsa -out privkey.pem 2048
so you must convert it e.g., with the following command:
openssl pkcs8 -topk8 -nocrypt -in privkey.pem -inform PEM -out privkey.der -outform DER
The result is that you have two copies of the private key. The one ending with extension .der
(which is binary) can be imported using this method. Doing this conversion in Java is well past the scope of this
utility. If you use this on a key in the wrong format you will get an exception.