public class PGPSignatureSubpacketGenerator
extends java.lang.Object
Constructor and Description |
---|
PGPSignatureSubpacketGenerator()
Base constructor, creates an empty generator.
|
PGPSignatureSubpacketGenerator(PGPSignatureSubpacketVector sigSubV)
Constructor for pre-initialising the generator from an existing one.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomSubpacket(SignatureSubpacket subpacket)
Add a custom subpacket.
|
void |
addEmbeddedSignature(boolean isCritical,
PGPSignature pgpSignature)
Add an embedded signature packet.
|
void |
addIntendedRecipientFingerprint(boolean isCritical,
PGPPublicKey publicKey)
Adds a intended recipient fingerprint for an encrypted payload the signature is associated with.
|
void |
addNotationData(boolean isCritical,
boolean isHumanReadable,
java.lang.String notationName,
java.lang.String notationValue)
Add a notation data packet to the signature.
|
void |
addPolicyURI(boolean isCritical,
java.lang.String policyUri) |
void |
addRevocationKey(boolean isCritical,
int keyAlgorithm,
byte[] fingerprint)
Adds a revocation key sub packet.
|
void |
addSignerUserID(boolean isCritical,
byte[] rawUserID)
Add a signer user-id to the signature.
|
void |
addSignerUserID(boolean isCritical,
java.lang.String userID)
Add a signer user-id to the signature.
|
PGPSignatureSubpacketVector |
generate() |
SignatureSubpacket[] |
getSubpackets(int type)
Return all signature subpackets of the passed in type currently in
the generator.
|
boolean |
hasSubpacket(int type)
Return true if a particular subpacket type exists.
|
boolean |
removePacket(SignatureSubpacket packet)
Remove a previously set packet from the generator.
|
void |
setEmbeddedSignature(boolean isCritical,
PGPSignature pgpSignature)
Deprecated.
use
addEmbeddedSignature(boolean, PGPSignature) instead. |
void |
setExportable(boolean isCritical,
boolean isExportable)
Specify, whether or not the signature should be marked as exportable.
|
void |
setFeature(boolean isCritical,
byte feature)
Specify the set of features of the key.
|
void |
setIntendedRecipientFingerprint(boolean isCritical,
PGPPublicKey publicKey)
Deprecated.
|
void |
setIssuerFingerprint(boolean isCritical,
PGPPublicKey publicKey)
Sets the signature issuer fingerprint for the signing key.
|
void |
setIssuerFingerprint(boolean isCritical,
PGPSecretKey secretKey)
Sets the signature issuer fingerprint for the signing key.
|
void |
setIssuerKeyID(boolean isCritical,
long keyID)
Sets issuer key-id subpacket.
|
void |
setKeyExpirationTime(boolean isCritical,
long seconds)
Set the number of seconds a key is valid for after the time of its creation.
|
void |
setKeyFlags(boolean isCritical,
int flags)
Set this keys key flags.
|
void |
setNotationData(boolean isCritical,
boolean isHumanReadable,
java.lang.String notationName,
java.lang.String notationValue)
Deprecated.
use
addNotationData(boolean, boolean, String, String) instead. |
void |
setPreferredAEADAlgorithms(boolean isCritical,
int[] algorithms)
Specify the preferred AEAD algorithms of this key.
|
void |
setPreferredCompressionAlgorithms(boolean isCritical,
int[] algorithms)
Specify the preferred compression algorithms of this key.
|
void |
setPreferredHashAlgorithms(boolean isCritical,
int[] algorithms)
Specify the preferred hash algorithms of the key.
|
void |
setPreferredSymmetricAlgorithms(boolean isCritical,
int[] algorithms)
Specify the preferred symmetric encryption algorithms of the key.
|
void |
setPrimaryUserID(boolean isCritical,
boolean isPrimaryUserID) |
void |
setRevocable(boolean isCritical,
boolean isRevocable)
Specify, whether or not the signature is revocable.
|
void |
setRevocationKey(boolean isCritical,
int keyAlgorithm,
byte[] fingerprint)
Deprecated.
use
addRevocationKey(boolean, int, byte[]) instead. |
void |
setRevocationReason(boolean isCritical,
byte reason,
java.lang.String description)
Sets revocation reason sub packet.
|
void |
setSignatureCreationTime(boolean isCritical,
java.util.Date date)
Set the creation time for the signature.
|
void |
setSignatureExpirationTime(boolean isCritical,
long seconds)
Set the number of seconds a signature is valid for after the time of its creation.
|
void |
setSignatureTarget(boolean isCritical,
int publicKeyAlgorithm,
int hashAlgorithm,
byte[] hashData)
Sets the signature target sub packet.
|
void |
setSignerUserID(boolean isCritical,
byte[] rawUserID)
Deprecated.
use
addSignerUserID(boolean, byte[]) instead. |
void |
setSignerUserID(boolean isCritical,
java.lang.String userID)
Deprecated.
use
addSignerUserID(boolean, String) instead. |
void |
setTrust(boolean isCritical,
int depth,
int trustAmount)
Add a TrustSignature packet to the signature.
|
public PGPSignatureSubpacketGenerator()
public PGPSignatureSubpacketGenerator(PGPSignatureSubpacketVector sigSubV)
sigSubV
- an initial set of subpackets.public void setRevocable(boolean isCritical, boolean isRevocable)
isCritical
- true if should be treated as critical, false otherwise.isRevocable
- true if the signature should be revocable, false otherwise.public void setExportable(boolean isCritical, boolean isExportable)
isCritical
- true if should be treated as critical, false otherwise.isExportable
- true if the signature should be exportable, false otherwise.public void setFeature(boolean isCritical, byte feature)
isCritical
- true if should be treated as critical, false otherwise.feature
- featurespublic void setTrust(boolean isCritical, int depth, int trustAmount)
isCritical
- true if the packet is critical.depth
- depth level.trustAmount
- trust amount.public void setKeyExpirationTime(boolean isCritical, long seconds)
isCritical
- true if should be treated as critical, false otherwise.seconds
- public void setSignatureExpirationTime(boolean isCritical, long seconds)
isCritical
- true if should be treated as critical, false otherwise.seconds
- public void setSignatureCreationTime(boolean isCritical, java.util.Date date)
Note: this overrides the generation of a creation time when the signature is generated.
public void setPreferredHashAlgorithms(boolean isCritical, int[] algorithms)
HashAlgorithmTags
.isCritical
- true if should be treated as critical, false otherwise.algorithms
- array of algorithms in descending preferencepublic void setPreferredSymmetricAlgorithms(boolean isCritical, int[] algorithms)
SymmetricKeyAlgorithmTags
.isCritical
- true if should be treated as critical, false otherwise.algorithms
- array of algorithms in descending preferencepublic void setPreferredCompressionAlgorithms(boolean isCritical, int[] algorithms)
CompressionAlgorithmTags
.isCritical
- true if should be treated as critical, false otherwise.algorithms
- array of algorithms in descending preferencepublic void setPreferredAEADAlgorithms(boolean isCritical, int[] algorithms)
isCritical
- true if should be treated as critical, false otherwise.algorithms
- array of algorithms in descending preferencepublic void addPolicyURI(boolean isCritical, java.lang.String policyUri)
public void setKeyFlags(boolean isCritical, int flags)
PGPKeyFlags
.isCritical
- true if should be treated as critical, false otherwise.flags
- flagspublic void setSignerUserID(boolean isCritical, java.lang.String userID)
addSignerUserID(boolean, String)
instead.isCritical
- true if should be treated as critical, false otherwise.userID
- signer user-idpublic void addSignerUserID(boolean isCritical, java.lang.String userID)
isCritical
- true if should be treated as critical, false otherwise.userID
- signer user-idpublic void setSignerUserID(boolean isCritical, byte[] rawUserID)
addSignerUserID(boolean, byte[])
instead.isCritical
- true if should be treated as critical, false otherwise.rawUserID
- signer user-idpublic void addSignerUserID(boolean isCritical, byte[] rawUserID)
isCritical
- true if should be treated as critical, false otherwise.rawUserID
- signer user-idpublic void setEmbeddedSignature(boolean isCritical, PGPSignature pgpSignature) throws java.io.IOException
addEmbeddedSignature(boolean, PGPSignature)
instead.isCritical
- true if should be treated as critical, false otherwise.pgpSignature
- embedded signaturejava.io.IOException
- in case of an errorpublic void addEmbeddedSignature(boolean isCritical, PGPSignature pgpSignature) throws java.io.IOException
isCritical
- true if should be treated as critical, false otherwise.pgpSignature
- embedded signaturejava.io.IOException
- in case of an errorpublic void setPrimaryUserID(boolean isCritical, boolean isPrimaryUserID)
public void setNotationData(boolean isCritical, boolean isHumanReadable, java.lang.String notationName, java.lang.String notationValue)
addNotationData(boolean, boolean, String, String)
instead.isCritical
- true if should be treated as critical, false otherwise.isHumanReadable
- true if the notation is human-readable.notationName
- name of the notation keynotationValue
- value of the notationpublic void addNotationData(boolean isCritical, boolean isHumanReadable, java.lang.String notationName, java.lang.String notationValue)
isCritical
- true if should be treated as critical, false otherwise.isHumanReadable
- true if the notation is human-readable.notationName
- name of the notation key.notationValue
- value of the notation.public void setRevocationReason(boolean isCritical, byte reason, java.lang.String description)
RevocationReasonTags
.isCritical
- true if should be treated as critical, false otherwise.reason
- reason code for the revocationdescription
- human readable description of the revocation reasonpublic void setRevocationKey(boolean isCritical, int keyAlgorithm, byte[] fingerprint)
addRevocationKey(boolean, int, byte[])
instead.isCritical
- true if should be treated as critical, false otherwise.keyAlgorithm
- algorithm of the revocation keyfingerprint
- fingerprint of the revocation keypublic void addRevocationKey(boolean isCritical, int keyAlgorithm, byte[] fingerprint)
isCritical
- true if should be treated as critical, false otherwise.keyAlgorithm
- algorithm of the revocation keyfingerprint
- fingerprint of the revocation keypublic void setIssuerKeyID(boolean isCritical, long keyID)
isCritical
- true if should be treated as critical, false otherwise.keyID
- id of the key that issued the signaturepublic void setSignatureTarget(boolean isCritical, int publicKeyAlgorithm, int hashAlgorithm, byte[] hashData)
isCritical
- true if should be treated as critical, false otherwise.publicKeyAlgorithm
- algorithm of the key that issued the signature that is being referred to.hashAlgorithm
- hash algorithm that was used to calculate the hash data.hashData
- hash of the signature that is being referred to.public void setIssuerFingerprint(boolean isCritical, PGPSecretKey secretKey)
isCritical
- true if critical, false otherwise.secretKey
- the secret key used to generate the associated signature.public void setIssuerFingerprint(boolean isCritical, PGPPublicKey publicKey)
isCritical
- true if critical, false otherwise.publicKey
- the public key needed to verify the associated signature.public void setIntendedRecipientFingerprint(boolean isCritical, PGPPublicKey publicKey)
addIntendedRecipientFingerprint(boolean, PGPPublicKey)
instead.isCritical
- true if critical, false otherwise.publicKey
- the public key the encrypted payload was encrypted against.public void addIntendedRecipientFingerprint(boolean isCritical, PGPPublicKey publicKey)
isCritical
- true if critical, false otherwise.publicKey
- the public key the encrypted payload was encrypted against.public void addCustomSubpacket(SignatureSubpacket subpacket)
subpacket
- subpacketpublic boolean removePacket(SignatureSubpacket packet)
packet
- the signature subpacket to remove.public boolean hasSubpacket(int type)
type
- type to look for.public SignatureSubpacket[] getSubpackets(int type)
type
- subpacket type codepublic PGPSignatureSubpacketVector generate()