public class PemFile extends Object
Constructor and Description |
---|
PemFile(File pemFile)
Creates an instance for the specified file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsEncryptedPrivateKey() |
List<Certificate> |
getCertificates()
Obtains the list of certificates stored in the PEM file.
|
byte[] |
getPrivateKeyBytes()
Obtains the private key data as a byte array from the PEM file.
|
public PemFile(File pemFile)
Note that the file will be only be read on first use.
pemFile
- A PEM format file.public List<Certificate> getCertificates() throws CertificateException, IOException
CertificateException
- If a parsing error occurs.IOException
- If the PEM file cannot be read for any reason.public byte[] getPrivateKeyBytes() throws KeyException, IOException
Within the PEM file the private key data is base 64 encoded. This method will decode the data for the returned private key data.
Note that for an encrypted private key the data will remain encrypted.
KeyException
- If a private key cannot be found in the PEM file.IOException
- If the PEM file cannot be read for any reason.public boolean containsEncryptedPrivateKey() throws IOException
true
If the PEM file contains an encrypted private key, false
otherwise.IOException
- If the PEM file cannot be read for any reason.Copyright © 2016 International Business Machines Corporation. All rights reserved.