public final class Identities extends Object
限定符和类型 | 方法和说明 |
---|---|
static X509Identity |
newX509Identity(String mspId,
org.hyperledger.fabric.sdk.Enrollment enrollment)
Create a new X.509 identity from an enrollment returned from a Certificate Authority.
|
static X509Identity |
newX509Identity(String mspId,
X509Certificate certificate,
PrivateKey privateKey)
Create a new identity using X.509 credentials.
|
static 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 |
readX509Certificate(String pem)
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.
|
public static X509Identity newX509Identity(String mspId, X509Certificate certificate, PrivateKey privateKey)
mspId
- Member Services Provider identifier for the organization to which this identity belongs.certificate
- An X.509 certificate.privateKey
- Private key.NullPointerException
- if any of the arguments are null.public static X509Identity newX509Identity(String mspId, org.hyperledger.fabric.sdk.Enrollment enrollment) throws CertificateException
mspId
- Member Services Provider identifier.enrollment
- Identity credentials.CertificateException
- if the certificate is invalid.NullPointerException
- if any of the arguments are null.public static X509Certificate readX509Certificate(String pem) throws CertificateException
pem
- PEM data.CertificateException
- if the data is not valid X.509 certificate PEM.public static X509Certificate readX509Certificate(Reader pemReader) throws IOException, CertificateException
pemReader
- Reader of PEM data.IOException
- if an error occurs reading data.CertificateException
- if the data is not valid X.509 certificate PEM.public static PrivateKey readPrivateKey(String pem) throws InvalidKeyException
pem
- PEM data.InvalidKeyException
- if the data is not valid private key PEM.public static PrivateKey readPrivateKey(Reader pemReader) throws IOException, InvalidKeyException
pemReader
- Reader of PEM data.IOException
- if an error occurs reading data.InvalidKeyException
- if the data is not valid private key PEM.public static String toPemString(Certificate certificate)
certificate
- A certificate.public static String toPemString(PrivateKey privateKey)
privateKey
- A private key.IllegalArgumentException
- if the argument can not be represented in PKCS #8 PEM format.Copyright © 2023. All rights reserved.