org.bouncycastle.bcpg

Class SignaturePacket

Implemented Interfaces:
PacketTags, PublicKeyAlgorithmTags

public class SignaturePacket
extends ContainedPacket
implements PublicKeyAlgorithmTags

generic signature packet

Fields inherited from interface org.bouncycastle.bcpg.PacketTags

COMPRESSED_DATA, EXPERIMENTAL_1, EXPERIMENTAL_2, EXPERIMENTAL_3, EXPERIMENTAL_4, LITERAL_DATA, MARKER, MOD_DETECTION_CODE, ONE_PASS_SIGNATURE, PUBLIC_KEY, PUBLIC_KEY_ENC_SESSION, PUBLIC_SUBKEY, RESERVED, SECRET_KEY, SECRET_SUBKEY, SIGNATURE, SYMMETRIC_KEY_ENC, SYMMETRIC_KEY_ENC_SESSION, SYM_ENC_INTEGRITY_PRO, TRUST, USER_ATTRIBUTE, USER_ID

Fields inherited from interface org.bouncycastle.bcpg.PublicKeyAlgorithmTags

DIFFIE_HELLMAN, DSA, EC, ECDSA, ELGAMAL_ENCRYPT, ELGAMAL_GENERAL, RSA_ENCRYPT, RSA_GENERAL, RSA_SIGN

Constructor Summary

SignaturePacket(int version, int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, long creationTime, byte[] fingerPrint, MPInteger[] signature)
Generate a version 2/3 signature packet.
SignaturePacket(int version, int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, SignatureSubpacket[] hashedData, SignatureSubpacket[] unhashedData, byte[] fingerPrint, MPInteger[] signature)
SignaturePacket(int signatureType, long keyID, int keyAlgorithm, int hashAlgorithm, SignatureSubpacket[] hashedData, SignatureSubpacket[] unhashedData, byte[] fingerPrint, MPInteger[] signature)
Generate a version 4 signature packet.

Method Summary

void
encode(BCPGOutputStream out)
long
getCreationTime()
Return the creation time of the signature in milli-seconds.
int
getHashAlgorithm()
return the hashAlgorithm tag
SignatureSubpacket[]
getHashedSubPackets()
int
getKeyAlgorithm()
return the encryption algorithm tag
long
getKeyID()
return the keyID
MPInteger[]
getSignature()
return the signature bytes - note this is normalised to be the ASN.1 encoding of what appears in the signature packet.
byte[]
getSignatureTrailer()
return the signature trailer that must be included with the data to reconstruct the signature
int
getSignatureType()
return the signature type.
SignatureSubpacket[]
getUnhashedSubPackets()
int
getVersion()
get the version number

Methods inherited from class org.bouncycastle.bcpg.ContainedPacket

encode, getEncoded

Constructor Details

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 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 -

Method Details

encode

public void encode(BCPGOutputStream out)
            throws IOException
Overrides:
encode in interface ContainedPacket

getCreationTime

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

getHashAlgorithm

public int getHashAlgorithm()
return the hashAlgorithm tag

getHashedSubPackets

public SignatureSubpacket[] getHashedSubPackets()

getKeyAlgorithm

public int getKeyAlgorithm()
return the encryption algorithm tag

getKeyID

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

getSignature

public MPInteger[] getSignature()
return the signature bytes - note this is normalised to be the ASN.1 encoding of what appears in the signature packet.

getSignatureTrailer

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

getSignatureType

public int getSignatureType()
return the signature type.

getUnhashedSubPackets

public SignatureSubpacket[] getUnhashedSubPackets()

getVersion

public int getVersion()
get the version number