public class OnePassSignaturePacket extends ContainedPacket
SignaturePackets of version 3 and 4.
Version 6 OPS packets are used with SignaturePackets of version 6.
It is not clear to me, which version of the OPS packet is intended to be used with version 5 signatures.| Modifier and Type | Field and Description |
|---|---|
static int |
VERSION_3 |
static int |
VERSION_6 |
AEAD_ENC_DATA, COMPRESSED_DATA, EXPERIMENTAL_1, EXPERIMENTAL_2, EXPERIMENTAL_3, EXPERIMENTAL_4, LITERAL_DATA, MARKER, MOD_DETECTION_CODE, ONE_PASS_SIGNATURE, PADDING, PUBLIC_KEY, PUBLIC_KEY_ENC_SESSION, PUBLIC_SUBKEY, RESERVED, SECRET_KEY, SECRET_SUBKEY, SIGNATURE, SYM_ENC_INTEGRITY_PRO, SYMMETRIC_KEY_ENC, SYMMETRIC_KEY_ENC_SESSION, TRUST, USER_ATTRIBUTE, USER_ID| Constructor and Description |
|---|
OnePassSignaturePacket(int sigType,
int hashAlgorithm,
int keyAlgorithm,
byte[] salt,
byte[] fingerprint,
boolean isNested)
Create a version 6
OnePassSignaturePacket. |
OnePassSignaturePacket(int sigType,
int hashAlgorithm,
int keyAlgorithm,
long keyID,
boolean isNested)
Create a version 3
OnePassSignaturePacket. |
| Modifier and Type | Method and Description |
|---|---|
void |
encode(BCPGOutputStream out)
Encode the contents of this packet into the given packet output stream.
|
byte[] |
getFingerprint()
Return the version 6 fingerprint of the issuer.
|
int |
getHashAlgorithm()
Return the algorithm ID of the hash algorithm.
|
int |
getKeyAlgorithm()
Return the ID of the public key encryption algorithm.
|
long |
getKeyID()
Return the key-id of the signing key.
|
byte[] |
getSalt()
Return the salt used in the signature.
|
int |
getSignatureType()
Return the signature type.
|
int |
getVersion()
Return the packet version.
|
boolean |
isContaining()
Return true, if the signature contains any signatures that follow.
|
getEncoded, getEncodedgetPacketTag, hasNewPacketFormat, isCriticalpublic static final int VERSION_3
public static final int VERSION_6
public OnePassSignaturePacket(int sigType,
int hashAlgorithm,
int keyAlgorithm,
long keyID,
boolean isNested)
OnePassSignaturePacket.
Version 3 OPS packets are used with version 3 and version 4 SignaturePackets.
To create an OPS packet for use with a version 6 SignaturePacket,
see OnePassSignaturePacket(int, int, int, byte[], byte[], boolean).sigType - signature typehashAlgorithm - hash algorithm tagkeyAlgorithm - public key algorithm tagkeyID - id of the signing keyisNested - if false, there is another OPS packet after this one, which applies to the same data.
it true, the corresponding signature is calculated also over succeeding additional OPS packets.public OnePassSignaturePacket(int sigType,
int hashAlgorithm,
int keyAlgorithm,
byte[] salt,
byte[] fingerprint,
boolean isNested)
OnePassSignaturePacket.
Version 6 packets are emitted using the new (OpenPGP) packet format, not the Legacy format:
RFC 9580 sec. 4.2 says the Legacy packet format "SHOULD NOT be used to generate new data", and
v6 artefacts are new data by definition. Emitting a v6 OPS packet with a Legacy header breaks
interoperability with strict RFC 9580 consumers (PGPainless issue #33). This mirrors the v6
SignaturePacket constructor, which likewise defaults to the new packet format. A caller
that genuinely needs a Legacy header can still force it by encoding through a
BCPGOutputStream opened with PacketFormat.LEGACY.
sigType - signature typehashAlgorithm - hash algorithm tagkeyAlgorithm - public key algorithm tagsalt - random salt. The length of this array depends on the hash algorithm in use.fingerprint - 32 octet fingerprint of the (v6) signing keyisNested - if false, there is another OPS packet after this one, which applies to the same data.
it true, the corresponding signature is calculated also over succeeding additional OPS packets.public int getVersion()
public int getSignatureType()
public int getKeyAlgorithm()
public int getHashAlgorithm()
public long getKeyID()
public byte[] getFingerprint()
public byte[] getSalt()
public boolean isContaining()
public void encode(BCPGOutputStream out) throws java.io.IOException
encode in class ContainedPacketout - OpenPGP packet output streamjava.io.IOException