Serializable
, Comparable<Pem>
public enum Pem extends 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 | Method | Description |
---|---|---|
static List<PemObject> |
readPenObjects(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 PrivateKey |
readPrivateKey(InputStream is) |
Returns the first private key that is found from the input stream of a
PEM file.
|
static PublicKey |
readPublicKey(InputStream is) |
Returns the first public key that is found from the input stream of a PEM
file.
|
static Pem |
valueOf(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.
|
public static Pem[] values()
for (Pem c : Pem.values()) System.out.println(c);
public static Pem valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static PrivateKey readPrivateKey(InputStream is) throws InvalidKeySpecException, IOException
InvalidKeySpecException
- if failed to convert the DER bytes into a private key.IllegalArgumentException
- if no private key is found.IOException
public static PublicKey readPublicKey(InputStream is) throws InvalidKeySpecException, IOException
InvalidKeySpecException
- if failed to convert the DER bytes into a public key.IllegalArgumentException
- if no public key is found.IOException
public static List<PemObject> readPenObjects(InputStream is) throws IOException
This method can be useful if more than one PEM object of different types are embedded in the same PEM file.
IOException
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.