org.hyperledger.fabric.gateway

## 类 Identities

- java.lang.Object
- - org.hyperledger.fabric.gateway.Identities

-     public final class Identities
      extends Object

  This class consists exclusively of static methods used to create and operate on identity information.

- - ### 方法概要

    所有方法 静态方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `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.

    - ### 从类继承的方法 java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 方法详细资料

    - #### newX509Identity

          public static X509Identity newX509Identity(String mspId,
                                                     X509Certificate certificate,
                                                     PrivateKey privateKey)

      Create a new identity using X.509 credentials.
      参数:
        `mspId` - Member Services Provider identifier for the organization to which this identity belongs.
        `certificate` - An X.509 certificate.
        `privateKey` - Private key.
      返回:
        An identity.
      抛出:
        `NullPointerException` - if any of the arguments are null.

    - #### newX509Identity

          public static X509Identity newX509Identity(String mspId,
                                                     org.hyperledger.fabric.sdk.Enrollment enrollment)
                                              throws CertificateException

      Create a new X.509 identity from an enrollment returned from a Certificate Authority.
      参数:
        `mspId` - Member Services Provider identifier.
        `enrollment` - Identity credentials.
      返回:
        An identity.
      抛出:
        `CertificateException` - if the certificate is invalid.
        `NullPointerException` - if any of the arguments are null.

    - #### readX509Certificate

          public static X509Certificate readX509Certificate(String pem)
                                                     throws CertificateException

      Read a PEM format X.509 certificate.
      参数:
        `pem` - PEM data.
      返回:
        An X.509 certificate.
      抛出:
        `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.
      参数:
        `pemReader` - Reader of PEM data.
      返回:
        An X.509 certificate.
      抛出:
        `IOException` - if an error occurs reading data.
        `CertificateException` - if the data is not valid X.509 certificate PEM.

    - #### readPrivateKey

          public static PrivateKey readPrivateKey(String pem)
                                           throws InvalidKeyException

      Read a PEM format private key.
      参数:
        `pem` - PEM data.
      返回:
        An X.509 certificate.
      抛出:
        `InvalidKeyException` - if the data is not valid private key PEM.

    - #### readPrivateKey

          public static PrivateKey readPrivateKey(Reader pemReader)
                                           throws IOException,
                                                  InvalidKeyException

      Read a PEM format private key.
      参数:
        `pemReader` - Reader of PEM data.
      返回:
        A private key.
      抛出:
        `IOException` - if an error occurs reading data.
        `InvalidKeyException` - if the data is not valid private key PEM.

    - #### toPemString

          public static String toPemString(Certificate certificate)

      Converts the argument to a PEM format string.
      参数:
        `certificate` - A certificate.
      返回:
        A PEM format string.

    - #### toPemString

          public static String toPemString(PrivateKey privateKey)

      Converts the argument to a PKCS #8 PEM format string.
      参数:
        `privateKey` - A private key.
      返回:
        A PEM format string.
      抛出:
        `IllegalArgumentException` - if the argument can not be represented in PKCS #8 PEM format.

Copyright © 2023. All rights reserved.