Class Identities
java.lang.Object
org.hyperledger.fabric.client.identity.Identities
Utility methods for creating and manipulating identity information.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrivateKey
readPrivateKey
(Reader pemReader) Read a PEM format private key.static PrivateKey
readPrivateKey
(String pem) Read a PEM format private key.static X509Certificate
readX509Certificate
(Reader pemReader) Read a PEM format X.509 certificate.static X509Certificate
Read a PEM format X.509 certificate.static String
toPemString
(Certificate certificate) Converts the argument to a PEM format string.static String
toPemString
(PrivateKey privateKey) Converts the argument to a PKCS #8 PEM format string.
-
Method Details
-
readX509Certificate
Read a PEM format X.509 certificate.- Parameters:
pem
- PEM data.- Returns:
- An X.509 certificate.
- Throws:
CertificateException
- if the data is not valid X.509 certificate PEM.
-
readX509Certificate
public static X509Certificate readX509Certificate(Reader pemReader) throws IOException, CertificateException Read a PEM format X.509 certificate.- Parameters:
pemReader
- Reader of PEM data.- Returns:
- An X.509 certificate.
- Throws:
IOException
- if an error occurs reading data.CertificateException
- if the data is not valid X.509 certificate PEM.
-
readPrivateKey
Read a PEM format private key.- Parameters:
pem
- PEM data.- Returns:
- An X.509 certificate.
- Throws:
InvalidKeyException
- if the data is not valid private key PEM.
-
readPrivateKey
Read a PEM format private key.- Parameters:
pemReader
- Reader of PEM data.- Returns:
- A private key.
- Throws:
IOException
- if an error occurs reading data.InvalidKeyException
- if the data is not valid private key PEM.
-
toPemString
Converts the argument to a PEM format string.- Parameters:
certificate
- A certificate.- Returns:
- A PEM format string.
-
toPemString
Converts the argument to a PKCS #8 PEM format string.- Parameters:
privateKey
- A private key.- Returns:
- A PEM format string.
- Throws:
IllegalArgumentException
- if the argument can not be represented in PKCS #8 PEM format.
-