Package org.bouncycastle.bcpg
Class SymmetricKeyEncSessionPacket
- java.lang.Object
-
- org.bouncycastle.bcpg.Packet
-
- org.bouncycastle.bcpg.ContainedPacket
-
- org.bouncycastle.bcpg.SymmetricKeyEncSessionPacket
-
- All Implemented Interfaces:
PacketTags,org.bouncycastle.util.Encodable
public class SymmetricKeyEncSessionPacket extends ContainedPacket
Basic type for a symmetric encrypted session key packet
-
-
Field Summary
Fields Modifier and Type Field Description static intVERSION_4Version 4 SKESK packet.static intVERSION_5Version 5 SKESK packet.static intVERSION_6Version 6 SKESK 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_ID
-
-
Constructor Summary
Constructors Constructor Description SymmetricKeyEncSessionPacket(int encAlgorithm, S2K s2k, byte[] secKeyData)Deprecated.use createVersion4Packet()SymmetricKeyEncSessionPacket(BCPGInputStream in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]createAAData(int version, int encAlgorithm, int aeadAlgorithm)static SymmetricKeyEncSessionPacketcreateV4Packet(int encAlgorithm, S2K s2k, byte[] secKeyData)Create a v4 SKESK packet.static SymmetricKeyEncSessionPacketcreateV5Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)Create a v5 SKESK packet.static SymmetricKeyEncSessionPacketcreateV6Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)Create a v6 SKESK packet.voidencode(BCPGOutputStream out)byte[]getAAData()intgetAeadAlgorithm()Return the AEAD algorithm tag.byte[]getAuthTag()Return the authentication tag for the AEAD mode.intgetEncAlgorithm()byte[]getIv()Return the IV for the AEAD mode.S2KgetS2K()byte[]getSecKeyData()intgetVersion()-
Methods inherited from class org.bouncycastle.bcpg.ContainedPacket
getEncoded
-
Methods inherited from class org.bouncycastle.bcpg.Packet
getPacketTag, isCritical
-
-
-
-
Field Detail
-
VERSION_4
public static final int VERSION_4
- See Also:
- Constant Field Values
-
VERSION_5
public static final int VERSION_5
Version 5 SKESK packet. Used only withAEDpackets.- See Also:
- Constant Field Values
-
VERSION_6
public static final int VERSION_6
Version 6 SKESK packet. Used only withV2 SEIPDpackets.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SymmetricKeyEncSessionPacket
public SymmetricKeyEncSessionPacket(BCPGInputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
SymmetricKeyEncSessionPacket
public SymmetricKeyEncSessionPacket(int encAlgorithm, S2K s2k, byte[] secKeyData)Deprecated.use createVersion4Packet()Create a v4 SKESK packet.- Parameters:
encAlgorithm- symmetric encryption algorithms2k- s2ksecKeyData- encrypted session key
-
-
Method Detail
-
createV4Packet
public static SymmetricKeyEncSessionPacket createV4Packet(int encAlgorithm, S2K s2k, byte[] secKeyData)
Create a v4 SKESK packet.- Parameters:
encAlgorithm- symmetric encryption algorithms2k- s2k specifiersecKeyData- encrypted session key
-
createV5Packet
public static SymmetricKeyEncSessionPacket createV5Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)
Create a v5 SKESK packet.- Parameters:
encAlgorithm- symmetric encryption algorithmaeadAlgorithm- aead algorithmiv- initialization vectors2k- s2k specifiersecKeyData- encrypted session keyauthTag- authentication tag
-
createV6Packet
public static SymmetricKeyEncSessionPacket createV6Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)
Create a v6 SKESK packet.- Parameters:
encAlgorithm- symmetric encryption algorithmaeadAlgorithm- aead algorithms2k- s2k specifieriv- initialization vectorsecKeyData- encrypted session keyauthTag- authentication tag
-
getEncAlgorithm
public int getEncAlgorithm()
- Returns:
- int
-
getS2K
public S2K getS2K()
- Returns:
- S2K
-
getSecKeyData
public byte[] getSecKeyData()
- Returns:
- byte[]
-
getVersion
public int getVersion()
- Returns:
- int
-
getAeadAlgorithm
public int getAeadAlgorithm()
Return the AEAD algorithm tag. V5 packet only.- Returns:
- aead algorithm
-
getIv
public byte[] getIv()
Return the IV for the AEAD mode. This is also called nonce. V5 packet only.- Returns:
- iv
-
getAuthTag
public byte[] getAuthTag()
Return the authentication tag for the AEAD mode. V5 packet only.- Returns:
- AEAD auth tag
-
getAAData
public byte[] getAAData()
-
createAAData
public static byte[] createAAData(int version, int encAlgorithm, int aeadAlgorithm)
-
encode
public void encode(BCPGOutputStream out) throws java.io.IOException
- Specified by:
encodein classContainedPacket- Throws:
java.io.IOException
-
-