org.bouncycastle.bcpg
Class PublicKeyEncSessionPacket
java.lang.Object
|
+--org.bouncycastle.bcpg.Packet
|
+--org.bouncycastle.bcpg.ContainedPacket
|
+--org.bouncycastle.bcpg.PublicKeyEncSessionPacket
- All Implemented Interfaces:
- org.bouncycastle.util.Encodable, PacketTags, PublicKeyAlgorithmTags
- public class PublicKeyEncSessionPacket
- extends ContainedPacket
- implements PublicKeyAlgorithmTags
basic packet for a PGP public key
Field Summary |
static int |
VERSION_3
Version 3 PKESK packet. |
static int |
VERSION_6
Version 6 PKESK packet. |
Fields inherited from interface org.bouncycastle.bcpg.PublicKeyAlgorithmTags |
AEDH, AEDSA, DIFFIE_HELLMAN, DSA, EC, ECDH, ECDSA, Ed25519, Ed448, EDDSA, EDDSA_LEGACY, ELGAMAL_ENCRYPT, ELGAMAL_GENERAL, EXPERIMENTAL_1, EXPERIMENTAL_10, EXPERIMENTAL_11, EXPERIMENTAL_2, EXPERIMENTAL_3, EXPERIMENTAL_4, EXPERIMENTAL_5, EXPERIMENTAL_6, EXPERIMENTAL_7, EXPERIMENTAL_8, EXPERIMENTAL_9, RSA_ENCRYPT, RSA_GENERAL, RSA_SIGN, X25519, X448 |
Fields inherited from interface org.bouncycastle.bcpg.PacketTags |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VERSION_3
public static final int VERSION_3
- Version 3 PKESK packet.
Used only with
V1 SEIPD
or SED
packets.
VERSION_6
public static final int VERSION_6
- Version 6 PKESK packet.
Used only with
V2 SEIPD
packets.
PublicKeyEncSessionPacket
public PublicKeyEncSessionPacket(long keyID,
int algorithm,
byte[][] data)
- Create a new V3 PKESK packet.
- Parameters:
keyID
- ID of the recipient key, 0 for anonymousalgorithm
- public key algorithmdata
- session data
PublicKeyEncSessionPacket
public PublicKeyEncSessionPacket(int keyVersion,
byte[] keyFingerprint,
int algorithm,
byte[][] data)
- Create a new V6 PKESK packet.
- Parameters:
keyVersion
- version of the keykeyFingerprint
- fingerprint of the keyalgorithm
- public key algorithmdata
- session data
createV3PKESKPacket
public static PublicKeyEncSessionPacket createV3PKESKPacket(long keyID,
int algorithm,
byte[][] data)
- Create a new V3 PKESK packet.
- Parameters:
keyID
- ID of the recipient key, 0 for anonymousalgorithm
- public key algorithmdata
- session data
createV6PKESKPacket
public static PublicKeyEncSessionPacket createV6PKESKPacket(int keyVersion,
byte[] keyFingerprint,
int algorithm,
byte[][] data)
- Create a new V6 PKESK packet.
- Parameters:
keyVersion
- version of the keykeyFingerprint
- fingerprint of the keyalgorithm
- public key algorithmdata
- session data
getVersion
public int getVersion()
- Return the version of this PKESK packet.
- Returns:
- version
getKeyID
public long getKeyID()
- Return the id of the recipient key.
V3 PKESK only. TODO: Add conversion from fingerprint to key-id for V6 PKESK?
- Returns:
- key id
getKeyFingerprint
public byte[] getKeyFingerprint()
- Return the fingerprint of the recipient key.
If the recipient key is anonymous, this method returns an empty array.
V6 PKESK packet only.
- Returns:
- key fingerprint
getKeyVersion
public int getKeyVersion()
- Return the version number of the recipient key.
If the recipient key is anonymous, this method returns 0.
V6 PKESK packet only.
- Returns:
- key version
getAlgorithm
public int getAlgorithm()
- Return the public key algorithm of the recipient key.
- Returns:
- public key algorithm
getEncSessionKey
public byte[][] getEncSessionKey()
encode
public void encode(BCPGOutputStream out)
throws java.io.IOException
- Overrides:
encode
in class ContainedPacket