Class C509PrivateKeyPossessionStatement

java.lang.Object
org.bouncycastle.cbor.c509.C509PrivateKeyPossessionStatement

public class C509PrivateKeyPossessionStatement extends Object
The C509 form of the RFC 9883 privateKeyPossessionStatement certification request attribute (Section 4.3.3 of draft-ietf-cose-cbor-encoded-cert-21):
PrivateKeyPossessionStatement = [
  issuer: Name,
  certificateSerialNumber: CertificateSerialNumber,
  cert: C509CertData / null,
]
The issuer and serial number name the signature certificate whose holder vouches for possession of the key-establishment private key; the certificate itself may be carried alongside, as a C509 certificate of either type. In a CBOR re-encoded (type 3) request the certificate must itself be a re-encoded (type 3) C509 certificate, or the RFC 2986 request cannot be reconstructed.
  • Constructor Details

    • C509PrivateKeyPossessionStatement

      public C509PrivateKeyPossessionStatement(org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serialNumber)
      A statement naming the signature certificate without carrying it.
    • C509PrivateKeyPossessionStatement

      public C509PrivateKeyPossessionStatement(C509Certificate certificate)
      A statement carrying the signature certificate, named by its own issuer and serial number.
    • C509PrivateKeyPossessionStatement

      public C509PrivateKeyPossessionStatement(org.bouncycastle.asn1.x500.X500Name issuer, BigInteger serialNumber, C509Certificate certificate)
      A statement naming the signature certificate, optionally carrying it.
      Parameters:
      certificate - the signature certificate, or null to omit it.
  • Method Details

    • getInstance

      public static C509PrivateKeyPossessionStatement getInstance(byte[] cborEncoding) throws IOException
      Parse a statement from the CBOR encoding of the attribute value (the array).
      Throws:
      IOException
    • fromPrivateKeyPossessionStatement

      public static C509PrivateKeyPossessionStatement fromPrivateKeyPossessionStatement(org.bouncycastle.asn1.x509.PrivateKeyPossessionStatement statement, C509ConversionOptions options) throws IOException
      Build the C509 form of an RFC 9883 statement, re-encoding any certificate it carries as a type 3 C509 certificate.
      Throws:
      IOException - if the issuer name or the certificate cannot be represented in C509.
    • toPrivateKeyPossessionStatement

      public org.bouncycastle.asn1.x509.PrivateKeyPossessionStatement toPrivateKeyPossessionStatement() throws IOException
      Return the RFC 9883 form of this statement.
      Throws:
      IOException - if the certificate carried is natively signed (type 2) and so has no X.509 form.
    • getIssuer

      public org.bouncycastle.asn1.x500.X500Name getIssuer()
      Return the issuer name of the signature certificate.
    • getSerialNumber

      public BigInteger getSerialNumber()
      Return the serial number of the signature certificate.
    • getCertificate

      public C509Certificate getCertificate()
      Return the signature certificate, or null if the statement only names it.
    • getEncoded

      public byte[] getEncoded() throws IOException
      Return the CBOR encoding of the attribute value.
      Throws:
      IOException