Top Description Fields Constructors Methods
org.bouncycastle.bcpg

public Class SymmetricKeyEncSessionPacket

extends ContainedPacket
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .EOFException, .IOException

Basic type for a symmetric encrypted session key packet

Field Summary

Modifier and TypeField and Description
private int
private byte[]
private int
private byte[]
private S2K
private byte[]
private byte[]
private int
public static final int
VERSION_4

Version 4 SKESK packet.

public static final int
VERSION_5

Version 5 SKESK packet.

public static final int
VERSION_6

Version 6 SKESK packet.

Constructor Summary

AccessConstructor and Description
public
public
SymmetricKeyEncSessionPacket(BCPGInputStream in, boolean newPacketFormat)

public
SymmetricKeyEncSessionPacket(int
symmetric encryption algorithm
encAlgorithm
,
S2K
s2k
s2k
,
byte[]
encrypted session key
secKeyData
)
Deprecated use createVersion4Packet()

Create a v4 SKESK packet.

private
SymmetricKeyEncSessionPacket(int version, int
symmetric encryption algorithm
encAlgorithm
,
int
aead algorithm
aeadAlgorithm
,
byte[]
initialization vector
iv
,
S2K
s2k specifier
s2k
,
byte[]
encrypted session key
secKeyData
,
byte[]
authentication tag
authTag
)

Create a v5 or v6 SKESK packet.

Method Summary

Modifier and TypeMethod and Description
public static byte[]
createAAData(int version, int encAlgorithm, int aeadAlgorithm)

public static SymmetricKeyEncSessionPacket
createV4Packet(int
symmetric encryption algorithm
encAlgorithm
,
S2K
s2k specifier
s2k
,
byte[]
encrypted session key
secKeyData
)

Create a v4 SKESK packet.

public static SymmetricKeyEncSessionPacket
createV5Packet(int
symmetric encryption algorithm
encAlgorithm
,
int
aead algorithm
aeadAlgorithm
,
byte[]
initialization vector
iv
,
S2K
s2k specifier
s2k
,
byte[]
encrypted session key
secKeyData
,
byte[]
authentication tag
authTag
)

Create a v5 SKESK packet.

public static SymmetricKeyEncSessionPacket
createV6Packet(int
symmetric encryption algorithm
encAlgorithm
,
int
aead algorithm
aeadAlgorithm
,
byte[]
initialization vector
iv
,
S2K
s2k specifier
s2k
,
byte[]
encrypted session key
secKeyData
,
byte[]
authentication tag
authTag
)

Create a v6 SKESK packet.

public void
public byte[]
public int

Returns:

aead algorithm
getAeadAlgorithm
()

Return the AEAD algorithm tag.

public byte[]

Returns:

AEAD auth tag
getAuthTag
()

Return the authentication tag for the AEAD mode.

public int

Returns:

int
getEncAlgorithm
()

public byte[]

Returns:

iv
getIv
()

Return the IV for the AEAD mode.

public S2K

Returns:

S2K
getS2K
()

public byte[]

Returns:

byte[]
getSecKeyData
()

public int

Returns:

int
getVersion
()

Inherited from org.bouncycastle.bcpg.ContainedPacket:
getEncodedgetEncoded

Field Detail

aeadAlgorithmback to summary
private int aeadAlgorithm
authTagback to summary
private byte[] authTag
encAlgorithmback to summary
private int encAlgorithm
ivback to summary
private byte[] iv
s2kback to summary
private S2K s2k
s2kBytesback to summary
private byte[] s2kBytes
secKeyDataback to summary
private byte[] secKeyData
versionback to summary
private int version
VERSION_4back to summary
public static final int VERSION_4

Version 4 SKESK packet. Used only with V1 SEIPD or SED packets.

VERSION_5back to summary
public static final int VERSION_5

Version 5 SKESK packet. LibrePGP only. Used only with AED packets.

VERSION_6back to summary
public static final int VERSION_6

Version 6 SKESK packet. Used only with V2 SEIPD packets.

Constructor Detail

SymmetricKeyEncSessionPacketback to summary
public SymmetricKeyEncSessionPacket(BCPGInputStream in) throws IOException
SymmetricKeyEncSessionPacketback to summary
public SymmetricKeyEncSessionPacket(BCPGInputStream in, boolean newPacketFormat) throws IOException
SymmetricKeyEncSessionPacketback to summary
public SymmetricKeyEncSessionPacket(int encAlgorithm, S2K s2k, byte[] secKeyData)

Deprecated

use createVersion4Packet()

Create a v4 SKESK packet.

Parameters
encAlgorithm:int

symmetric encryption algorithm

s2k:S2K

s2k

secKeyData:byte[]

encrypted session key

SymmetricKeyEncSessionPacketback to summary
private SymmetricKeyEncSessionPacket(int version, int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)

Create a v5 or v6 SKESK packet.

Parameters
encAlgorithm:int

symmetric encryption algorithm

aeadAlgorithm:int

aead algorithm

iv:byte[]

initialization vector

s2k:S2K

s2k specifier

secKeyData:byte[]

encrypted session key

authTag:byte[]

authentication tag

Method Detail

createAADataback to summary
public static byte[] createAAData(int version, int encAlgorithm, int aeadAlgorithm)
createV4Packetback to summary
public static SymmetricKeyEncSessionPacket createV4Packet(int encAlgorithm, S2K s2k, byte[] secKeyData)

Create a v4 SKESK packet.

Parameters
encAlgorithm:int

symmetric encryption algorithm

s2k:S2K

s2k specifier

secKeyData:byte[]

encrypted session key

createV5Packetback to summary
public static SymmetricKeyEncSessionPacket createV5Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)

Create a v5 SKESK packet.

Parameters
encAlgorithm:int

symmetric encryption algorithm

aeadAlgorithm:int

aead algorithm

iv:byte[]

initialization vector

s2k:S2K

s2k specifier

secKeyData:byte[]

encrypted session key

authTag:byte[]

authentication tag

createV6Packetback to summary
public static SymmetricKeyEncSessionPacket createV6Packet(int encAlgorithm, int aeadAlgorithm, byte[] iv, S2K s2k, byte[] secKeyData, byte[] authTag)

Create a v6 SKESK packet.

Parameters
encAlgorithm:int

symmetric encryption algorithm

aeadAlgorithm:int

aead algorithm

iv:byte[]

initialization vector

s2k:S2K

s2k specifier

secKeyData:byte[]

encrypted session key

authTag:byte[]

authentication tag

encodeback to summary
public void encode(BCPGOutputStream out) throws IOException

Implements abstract org.bouncycastle.bcpg.ContainedPacket.encode.

getAADataback to summary
public byte[] getAAData()
getAeadAlgorithmback to summary
public int getAeadAlgorithm()

Return the AEAD algorithm tag. V5 packet only.

Returns:int

aead algorithm

getAuthTagback to summary
public byte[] getAuthTag()

Return the authentication tag for the AEAD mode. V5 packet only.

Returns:byte[]

AEAD auth tag

getEncAlgorithmback to summary
public int getEncAlgorithm()
Returns:int

int

getIvback to summary
public byte[] getIv()

Return the IV for the AEAD mode. This is also called nonce. V5 packet only.

Returns:byte[]

iv

getS2Kback to summary
public S2K getS2K()
Returns:S2K

S2K

getSecKeyDataback to summary
public byte[] getSecKeyData()
Returns:byte[]

byte[]

getVersionback to summary
public int getVersion()
Returns:int

int