public class PublicKeyPacket extends ContainedPacket implements PublicKeyAlgorithmTags
| Modifier and Type | Field and Description |
|---|---|
static int |
LIBREPGP_5
Non-Standard LibrePGP introduced v5, which is only supported by a subset of vendors.
|
static int |
VERSION_3
OpenPGP v3 keys are deprecated.
|
static int |
VERSION_4
OpenPGP v4 keys are (at the time of writing) widely used, but are subject to some attacks.
|
static int |
VERSION_6
OpenPGP v6 keys are newly introduced.
|
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, X448AEAD_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 and Description |
|---|
PublicKeyPacket(int algorithm,
java.util.Date time,
BCPGKey key)
Deprecated.
use versioned
PublicKeyPacket(int, int, Date, BCPGKey) instead |
PublicKeyPacket(int version,
int algorithm,
java.util.Date time,
BCPGKey key)
Construct an OpenPGP public primary key packet.
|
| Modifier and Type | Method and Description |
|---|---|
void |
encode(BCPGOutputStream out)
Encode the packet to the OpenPGP
BCPGOutputStream. |
int |
getAlgorithm()
Return the
algorithm id of the public key. |
byte[] |
getEncodedContents()
Return the encoded packet contents without the packet frame.
|
BCPGKey |
getKey()
Return the key object.
|
static long |
getKeyID(PublicKeyPacket publicPk,
byte[] fingerprint) |
java.util.Date |
getTime()
Return the keys creation time.
|
int |
getValidDays()
Deprecated.
v4 and v6 keys instead signal their expiration time via the
KeyExpirationTime signature subpacket. |
int |
getVersion()
Return the packet version.
|
getEncoded, getEncodedgetPacketTag, hasNewPacketFormat, isCriticalpublic static final int VERSION_3
public static final int VERSION_4
public static final int LIBREPGP_5
public static final int VERSION_6
@Deprecated
public PublicKeyPacket(int algorithm,
java.util.Date time,
BCPGKey key)
PublicKeyPacket(int, int, Date, BCPGKey) insteadalgorithm - public key algorithm idtime - creation timekey - key objectpublic PublicKeyPacket(int version,
int algorithm,
java.util.Date time,
BCPGKey key)
version - packet versionalgorithm - public key algorithm idtime - creation timekey - key objectpublic int getVersion()
public int getAlgorithm()
algorithm id of the public key.public int getValidDays()
KeyExpirationTime signature subpacket.public java.util.Date getTime()
public BCPGKey getKey()
public byte[] getEncodedContents()
throws java.io.IOException
java.io.IOExceptionpublic void encode(BCPGOutputStream out) throws java.io.IOException
BCPGOutputStream.
If the BCPGOutputStream packet format is set to PacketFormat.ROUNDTRIP, the result
of Packet.hasNewPacketFormat() determines, which packet format is used to encode the packet.
Otherwise, the BCPGOutputStream dictates which format to use.encode in class ContainedPacketout - packet output streamjava.io.IOExceptionpublic static long getKeyID(PublicKeyPacket publicPk, byte[] fingerprint)