public enum PEM extends java.lang.Enum<PEM>
Some background information:
openssl pkcs8 -topk8 -in pk-APKAJM22QV32R3I2XVIQ.pem -inform pem -out pk-APKAJM22QV32R3I2XVIQ_pk8.pem -outform pem -nocrypt
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
BEGIN_MARKER |
Modifier and Type | Method and Description |
---|---|
static java.util.List<PEMObject> |
readPEMObjects(java.io.InputStream is)
A lower level API used to returns all PEM objects that can be read off
from the input stream of a PEM file.
|
static java.security.PrivateKey |
readPrivateKey(java.io.InputStream is)
Returns the first private key that is found from the input stream of a
PEM file.
|
static java.security.PublicKey |
readPublicKey(java.io.InputStream is)
Returns the first public key that is found from the input stream of a PEM
file.
|
static PEM |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static PEM[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
private static final java.lang.String BEGIN_MARKER
public static PEM[] values()
for (PEM c : PEM.values()) System.out.println(c);
public static PEM valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static java.security.PrivateKey readPrivateKey(java.io.InputStream is) throws java.security.spec.InvalidKeySpecException, java.io.IOException
java.security.spec.InvalidKeySpecException
- if failed to convert the DER bytes into a private key.java.lang.IllegalArgumentException
- if no private key is found.java.io.IOException
public static java.security.PublicKey readPublicKey(java.io.InputStream is) throws java.security.spec.InvalidKeySpecException, java.io.IOException
java.security.spec.InvalidKeySpecException
- if failed to convert the DER bytes into a public key.java.lang.IllegalArgumentException
- if no public key is found.java.io.IOException
public static java.util.List<PEMObject> readPEMObjects(java.io.InputStream is) throws java.io.IOException
This method can be useful if more than one PEM object of different types are embedded in the same PEM file.
java.io.IOException