Class SignaturePacket

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

public class SignaturePacket extends ContainedPacket implements PublicKeyAlgorithmTags
generic signature packet
  • 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)
  • 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 signatures fingerprint.
      Returns:
      fingerprint (digest prefix) of the signature
    • 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.
    • 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