public final class Pem extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<PemObject> |
readPemObjects(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.
|
public 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.IOExceptionpublic 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.IOExceptionpublic static List<PemObject> readPemObjects(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.
IOExceptionCopyright © 2023. All rights reserved.