Top Description Fields Constructors Methods
org.bouncycastle.bcpg

public Class PublicKeyEncSessionPacket

extends ContainedPacket
implements PublicKeyAlgorithmTags
Class Inheritance
All Implemented Interfaces
org.bouncycastle.bcpg.PublicKeyAlgorithmTags
Imports
java.io.ByteArrayOutputStream, .IOException, org.bouncycastle.util.Arrays, org.bouncycastle.util.io.Streams

basic packet for a PGP public key

Field Summary

Modifier and TypeField and Description
private int
private byte[][]
private byte[]
private long
private int
private int
public static final int
VERSION_3

Version 3 PKESK packet.

public static final int
VERSION_6

Version 6 PKESK packet.

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
PublicKeyEncSessionPacket(BCPGInputStream in, boolean newPacketFormat)

public
PublicKeyEncSessionPacket(long
ID of the recipient key, 0 for anonymous
keyID
,
int
public key algorithm
algorithm
,
byte[][]
session data
data
)

Create a new V3 PKESK packet.

public
PublicKeyEncSessionPacket(int
version of the key
keyVersion
,
byte[]
fingerprint of the key
keyFingerprint
,
int
public key algorithm
algorithm
,
byte[][]
session data
data
)

Create a new V6 PKESK packet.

Method Summary

Modifier and TypeMethod and Description
public static PublicKeyEncSessionPacket
createV3PKESKPacket(long
ID of the recipient key, 0 for anonymous
keyID
,
int
public key algorithm
algorithm
,
byte[][]
session data
data
)

Create a new V3 PKESK packet.

public static PublicKeyEncSessionPacket
createV6PKESKPacket(int
version of the key
keyVersion
,
byte[]
fingerprint of the key
keyFingerprint
,
int
public key algorithm
algorithm
,
byte[][]
session data
data
)

Create a new V6 PKESK packet.

public void
public int

Returns:

public key algorithm
getAlgorithm
()

Return the public key algorithm of the recipient key.

public byte[][]
public byte[]

Returns:

key fingerprint
getKeyFingerprint
()

Return the fingerprint of the recipient key.

public long

Returns:

key id
getKeyID
()

Return the id of the recipient key.

public int

Returns:

key version
getKeyVersion
()

Return the version number of the recipient key.

public int

Returns:

version
getVersion
()

Return the version of this PKESK packet.

Inherited from org.bouncycastle.bcpg.ContainedPacket:
getEncodedgetEncoded

Field Detail

algorithmback to summary
private int algorithm
databack to summary
private byte[][] data
keyFingerprintback to summary
private byte[] keyFingerprint
keyIDback to summary
private long keyID
keyVersionback to summary
private int keyVersion
versionback to summary
private int version
VERSION_3back to summary
public static final int VERSION_3

Version 3 PKESK packet. Used only with V1 SEIPD or SED packets.

VERSION_6back to summary
public static final int VERSION_6

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

Constructor Detail

PublicKeyEncSessionPacketback to summary
pack-priv PublicKeyEncSessionPacket(BCPGInputStream in) throws IOException
PublicKeyEncSessionPacketback to summary
pack-priv PublicKeyEncSessionPacket(BCPGInputStream in, boolean newPacketFormat) throws IOException
PublicKeyEncSessionPacketback to summary
public PublicKeyEncSessionPacket(long keyID, int algorithm, byte[][] data)

Create a new V3 PKESK packet.

Parameters
keyID:long

ID of the recipient key, 0 for anonymous

algorithm:int

public key algorithm

data:byte[][]

session data

PublicKeyEncSessionPacketback to summary
public PublicKeyEncSessionPacket(int keyVersion, byte[] keyFingerprint, int algorithm, byte[][] data)

Create a new V6 PKESK packet.

Parameters
keyVersion:int

version of the key

keyFingerprint:byte[]

fingerprint of the key

algorithm:int

public key algorithm

data:byte[][]

session data

Method Detail

createV3PKESKPacketback to summary
public static PublicKeyEncSessionPacket createV3PKESKPacket(long keyID, int algorithm, byte[][] data)

Create a new V3 PKESK packet.

Parameters
keyID:long

ID of the recipient key, 0 for anonymous

algorithm:int

public key algorithm

data:byte[][]

session data

createV6PKESKPacketback to summary
public static PublicKeyEncSessionPacket createV6PKESKPacket(int keyVersion, byte[] keyFingerprint, int algorithm, byte[][] data)

Create a new V6 PKESK packet.

Parameters
keyVersion:int

version of the key

keyFingerprint:byte[]

fingerprint of the key

algorithm:int

public key algorithm

data:byte[][]

session data

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

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

getAlgorithmback to summary
public int getAlgorithm()

Return the public key algorithm of the recipient key.

Returns:int

public key algorithm

getEncSessionKeyback to summary
public byte[][] getEncSessionKey()
getKeyFingerprintback to summary
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:byte[]

key fingerprint

getKeyIDback to summary
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:long

key id

getKeyVersionback to summary
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:int

key version

getVersionback to summary
public int getVersion()

Return the version of this PKESK packet.

Returns:int

version