Package org.bouncycastle.bcpg
Class PublicKeyEncSessionPacket
java.lang.Object
org.bouncycastle.bcpg.Packet
org.bouncycastle.bcpg.ContainedPacket
org.bouncycastle.bcpg.PublicKeyEncSessionPacket
- All Implemented Interfaces:
PacketTags,PublicKeyAlgorithmTags,org.bouncycastle.util.Encodable
basic packet for a PGP public key
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intVersion 3 PKESK packet.static final intVersion 6 PKESK packet.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_IDFields inherited from interface org.bouncycastle.bcpg.PublicKeyAlgorithmTags
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 -
Constructor Summary
ConstructorsConstructorDescriptionPublicKeyEncSessionPacket(int keyVersion, byte[] keyFingerprint, int algorithm, byte[][] data) Create a new V6 PKESK packet.PublicKeyEncSessionPacket(long keyID, int algorithm, byte[][] data) Create a new V3 PKESK packet. -
Method Summary
Modifier and TypeMethodDescriptionstatic PublicKeyEncSessionPacketcreateV3PKESKPacket(long keyID, int algorithm, byte[][] data) Create a new V3 PKESK packet.static PublicKeyEncSessionPacketcreateV6PKESKPacket(int keyVersion, byte[] keyFingerprint, int algorithm, byte[][] data) Create a new V6 PKESK packet.voidencode(BCPGOutputStream out) intReturn the public key algorithm of the recipient key.byte[][]byte[]Return the fingerprint of the recipient key.longgetKeyID()Return the id of the recipient key.intReturn the version number of the recipient key.intReturn the version of this PKESK packet.Methods inherited from class org.bouncycastle.bcpg.ContainedPacket
getEncodedMethods inherited from class org.bouncycastle.bcpg.Packet
getPacketTag, isCritical
-
Field Details
-
VERSION_3
public static final int VERSION_3- See Also:
-
VERSION_6
public static final int VERSION_6Version 6 PKESK packet. Used only withV2 SEIPDpackets.- See Also:
-
-
Constructor Details
-
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
-
-
Method Details
-
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
- Specified by:
encodein classContainedPacket- Throws:
IOException
-