Class SignaturePacket

All Implemented Interfaces:
PacketTags, PublicKeyAlgorithmTags, org.bouncycastle.util.Encodable

public class SignaturePacket extends ContainedPacket implements PublicKeyAlgorithmTags
generic signature packet
  • Field Details

  • Constructor Details

    • SignaturePacket

      public SignaturePacket(int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, SignatureSubpacket[] hashedData, SignatureSubpacket[] unhashedData, byte[] fingerPrint, MPInteger[] signature)
      Generate a version 4 signature packet.
      Parameters:
      signatureType -
      keyAlgorithm -
      hashAlgorithm -
      hashedData -
      unhashedData -
      fingerPrint -
      signature -
    • SignaturePacket

      public SignaturePacket(int version, int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, long creationTime, byte[] fingerPrint, MPInteger[] signature)
      Generate a version 2/3 signature packet.
      Parameters:
      signatureType -
      keyAlgorithm -
      hashAlgorithm -
      fingerPrint -
      signature -
    • SignaturePacket

      public SignaturePacket(int version, int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, SignatureSubpacket[] hashedData, SignatureSubpacket[] unhashedData, byte[] fingerPrint, MPInteger[] signature)
    • SignaturePacket

      public SignaturePacket(int version, int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, SignatureSubpacket[] hashedData, SignatureSubpacket[] unhashedData, byte[] fingerPrint, byte[] signatureEncoding, byte[] salt)
    • SignaturePacket

      public SignaturePacket(int version, int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, SignatureSubpacket[] hashedData, SignatureSubpacket[] unhashedData, byte[] fingerPrint, MPInteger[] signature, byte[] salt)
  • Method Details

    • getVersion

      public int getVersion()
      get the version number
    • getSignatureType

      public int getSignatureType()
      return the signature type.
    • getKeyID

      public long getKeyID()
      return the keyID
      Returns:
      the keyID that created the signature.
    • getFingerPrint

      public byte[] getFingerPrint()
      Return the signature's fingerprint.
      Returns:
      fingerprint (digest prefix) of the signature
    • getSalt

      public byte[] getSalt()
      Return the signature's salt. Only for v6 signatures.
      Returns:
      salt
    • getSignatureTrailer

      public byte[] getSignatureTrailer()
      return the signature trailer that must be included with the data to reconstruct the signature
      Returns:
      byte[]
    • getKeyAlgorithm

      public int getKeyAlgorithm()
      return the encryption algorithm tag
    • getHashAlgorithm

      public int getHashAlgorithm()
      return the hashAlgorithm tag
    • getSignature

      public MPInteger[] getSignature()
      return the signature as a set of integers - note this is normalised to be the ASN.1 encoding of what appears in the signature packet. Note, that Ed25519 and Ed448 returns null, as the raw signature is stored in signatureEncoding only. For those, use getSignatureBytes() instead.
    • getSignatureBytes

      public byte[] getSignatureBytes()
      Return the byte encoding of the signature section.
      Returns:
      uninterpreted signature bytes.
    • getHashedSubPackets

      public SignatureSubpacket[] getHashedSubPackets()
    • getUnhashedSubPackets

      public SignatureSubpacket[] getUnhashedSubPackets()
    • getCreationTime

      public long getCreationTime()
      Return the creation time of the signature in milli-seconds.
      Returns:
      the creation time in millis
    • encode

      public void encode(BCPGOutputStream out) throws IOException
      Specified by:
      encode in class ContainedPacket
      Throws:
      IOException
    • fromByteArray

      public static SignaturePacket fromByteArray(byte[] data) throws IOException
      Throws:
      IOException