All Implemented Interfaces:
Serializable, DataStructure
Enclosing class:
KeyCertificate

private static final class KeyCertificate.X25519_Ed25519Certextends KeyCertificate
An immutable X25519/Ed25519 certificate.
  • Field Details

    • ED_DATA

      private static final byte[] ED_DATA
      The fixed bytes of the X25519 Ed25519 certificate.
    • ED_LENGTH

      private static final int ED_LENGTH
      Length of the X25519 Ed25519 certificate bytes.
    • _hashcode

      private final int _hashcode
      The cached hash code.
  • Constructor Details

    • X25519_Ed25519Cert

      public X25519_Ed25519Cert() throws DataFormatException
      Creates an immutable X25519/Ed25519 certificate.
      Throws:
      DataFormatException - if the built certificate data is invalid
  • Method Details

    • setCertificateType

      public void setCertificateType(int type)
      Prevent mutation of the immutable certificate.
      Overrides:
      setCertificateType in class Certificate
      Parameters:
      type - the certificate type to set
    • setPayload

      public void setPayload(byte[] payload)
      Prevent mutation of the immutable certificate.
      Overrides:
      setPayload in class Certificate
      Parameters:
      payload - the payload to set
    • readBytes

      public void readBytes(InputStream in) throws DataFormatException, IOException
      Prevent mutation of the immutable certificate.
      Specified by:
      readBytes in interface DataStructure
      Overrides:
      readBytes in class Certificate
      Parameters:
      in - stream to read from
      Throws:
      DataFormatException - if the data is improperly formatted
      IOException - if there was a problem reading the stream
    • writeBytes

      public void writeBytes(OutputStream out) throws IOException
      Overridden for efficiency.
      Specified by:
      writeBytes in interface DataStructure
      Overrides:
      writeBytes in class Certificate
      Parameters:
      out - stream to write to
      Throws:
      IOException - if there was a problem writing to the stream
    • writeBytes

      public int writeBytes(byte[] target, int offset)
      Overridden for efficiency.
      Overrides:
      writeBytes in class Certificate
      Parameters:
      target - the output array
      offset - the starting offset in the target
      Returns:
      the written length (NOT the new offset)
    • readBytes

      public int readBytes(byte[] source, int offset) throws DataFormatException
      Prevent mutation of the immutable certificate.
      Overrides:
      readBytes in class Certificate
      Parameters:
      source - the array holding the certificate data
      offset - the starting offset in the source
      Returns:
      the bytes consumed
      Throws:
      DataFormatException - if the data is malformed
    • size

      public int size()
      Overridden for efficiency.
      Overrides:
      size in class Certificate
      Returns:
      the size in bytes: 3 plus the payload length
    • hashCode

      public int hashCode()
      Overridden for efficiency.
      Overrides:
      hashCode in class Certificate