public abstract class PublicKeyKeyEncryptionMethodGenerator extends java.lang.Object implements PGPKeyEncryptionMethodGenerator
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SESSION_KEY_OBFUSCATION_PROPERTY |
protected boolean |
sessionKeyObfuscation |
protected boolean |
useWildcardRecipient |
static long |
WILDCARD
Deprecated.
use WILDCARD_KEYID
|
static byte[] |
WILDCARD_FINGERPRINT |
static long |
WILDCARD_KEYID |
Modifier | Constructor and Description |
---|---|
protected |
PublicKeyKeyEncryptionMethodGenerator(PGPPublicKey pubKey) |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
createSessionInfo(byte algorithm,
byte[] keyBytes) |
byte[][] |
encodeEncryptedSessionInfo(byte[] encryptedSessionInfo) |
protected abstract byte[] |
encryptSessionInfo(PGPPublicKey pubKey,
byte[] sessionKey,
byte symAlgId,
boolean isV3)
Encrypt a session key using the recipients public key.
|
ContainedPacket |
generate(PGPDataEncryptorBuilder dataEncryptorBuilder,
byte[] sessionKey)
Generate a Public-Key Encrypted Session-Key (PKESK) packet of version 3.
|
protected static byte[] |
getSessionInfo(byte[] ephPubEncoding,
byte optSymKeyAlgorithm,
byte[] wrappedSessionKey) |
PublicKeyKeyEncryptionMethodGenerator |
setSessionKeyObfuscation(boolean enabled)
Controls whether to obfuscate the size of ECDH session keys using extra padding where necessary.
|
PublicKeyKeyEncryptionMethodGenerator |
setUseWildcardKeyID(boolean enabled)
Deprecated.
use
setUseWildcardRecipient(boolean) instead
TODO: Remove in a future release |
PublicKeyKeyEncryptionMethodGenerator |
setUseWildcardRecipient(boolean enabled)
Controls whether the recipient key ID/fingerprint is hidden (replaced by a wildcard value).
|
public static final java.lang.String SESSION_KEY_OBFUSCATION_PROPERTY
public static final long WILDCARD_KEYID
public static final long WILDCARD
public static final byte[] WILDCARD_FINGERPRINT
protected boolean sessionKeyObfuscation
protected boolean useWildcardRecipient
protected PublicKeyKeyEncryptionMethodGenerator(PGPPublicKey pubKey)
public PublicKeyKeyEncryptionMethodGenerator setSessionKeyObfuscation(boolean enabled)
The default behaviour can be configured using the system property "org.bouncycastle.openpgp.session_key_obfuscation", or else it will default to enabled.
@Deprecated public PublicKeyKeyEncryptionMethodGenerator setUseWildcardKeyID(boolean enabled)
setUseWildcardRecipient(boolean)
instead
TODO: Remove in a future releaseenabled
- booleanpublic PublicKeyKeyEncryptionMethodGenerator setUseWildcardRecipient(boolean enabled)
enabled
- booleanpublic byte[][] encodeEncryptedSessionInfo(byte[] encryptedSessionInfo) throws PGPException
PGPException
public ContainedPacket generate(PGPDataEncryptorBuilder dataEncryptorBuilder, byte[] sessionKey) throws PGPException
Features.FEATURE_SEIPD_V2
or as a fallback.
Generate a Public-Key Encrypted Session-Key (PKESK) packet of version 6.
PKESKv6 packets are used with Symmetrically-Encrypted Integrity-Protected Data (SEIPD) packets
of version 2 only.
PKESKv6 packets are used with keys that support Features.FEATURE_SEIPD_V2
.generate
in interface PGPKeyEncryptionMethodGenerator
sessionKey
- session-key algorithm id + session-key + checksumPGPException
- if the PKESK packet cannot be generatedprotected byte[] createSessionInfo(byte algorithm, byte[] keyBytes)
protected abstract byte[] encryptSessionInfo(PGPPublicKey pubKey, byte[] sessionKey, byte symAlgId, boolean isV3) throws PGPException
pubKey
- recipients public keysessionKey
- session-keysymAlgId
- for v3: session key algorithm ID; for v6: 0PGPException
protected static byte[] getSessionInfo(byte[] ephPubEncoding, byte optSymKeyAlgorithm, byte[] wrappedSessionKey)