Top Description Fields Constructors Methods
org.bouncycastle.openpgp.operator.jcajce

public Class JcePBEKeyEncryptionMethodGenerator

extends PBEKeyEncryptionMethodGenerator
Class Inheritance
Imports
java.security.InvalidAlgorithmParameterException, .InvalidKeyException, .Provider, .SecureRandom, javax.crypto.BadPaddingException, .Cipher, .IllegalBlockSizeException, .SecretKey, javax.crypto.spec.IvParameterSpec, .SecretKeySpec, org.bouncycastle.bcpg.S2K, .SymmetricKeyUtils, org.bouncycastle.crypto.InvalidCipherTextException, org.bouncycastle.crypto.modes.AEADCipher, org.bouncycastle.crypto.params.AEADParameters, .KeyParameter, org.bouncycastle.jcajce.util.DefaultJcaJceHelper, .NamedJcaJceHelper, .ProviderJcaJceHelper, org.bouncycastle.openpgp.PGPException, .PGPUtil, org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator, .PGPDigestCalculator, org.bouncycastle.openpgp.operator.bc.BcAEADUtil

JCE based generator for password based encryption (PBE) data protection methods.

Field Summary

Modifier and TypeField and Description
private OperatorHelper

Constructor Summary

AccessConstructor and Description
public
JcePBEKeyEncryptionMethodGenerator(char[]
the passphrase to use as the primary source of key material.
passPhrase
,
PGPDigestCalculator
the digest calculator to use for key calculation.
s2kDigestCalculator
)

Create a PBE encryption method generator using the provided digest and the default S2K count for key generation.

public
JcePBEKeyEncryptionMethodGenerator(char[]
the passphrase to use as the primary source of key material.
passPhrase
)

Create a PBE encryption method generator using the default SHA-1 digest and the default S2K count for key generation.

public
JcePBEKeyEncryptionMethodGenerator(char[]
the passphrase to use as the primary source of key material.
passPhrase
,
PGPDigestCalculator
the digest calculator to use for key calculation.
s2kDigestCalculator
,
int
the single byte S2K count to use.
s2kCount
)

Create a PBE encryption method generator using the provided calculator and S2K count for key generation.

public
JcePBEKeyEncryptionMethodGenerator(char[]
the passphrase to use as the primary source of key material.
passPhrase
,
int
the single byte S2K count to use.
s2kCount
)

Create a PBE encryption method generator using the default SHA-1 digest calculator and a S2K count other than the default for key generation.

public

Method Summary

Modifier and TypeMethod and Description
protected byte[]
encryptSessionInfo(int encAlgorithm, byte[] key, byte[] sessionInfo)

Implements abstract org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.encryptSessionInfo.

protected byte[]
generateV6KEK(int kekAlgorithm, byte[] ikm, byte[] info)

Implements abstract org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.generateV6KEK.

protected byte[]
getEskAndTag(int kekAlgorithm, int aeadAlgorithm, byte[] sessionKey, byte[] key, byte[] iv, byte[] info)

Implements abstract org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.getEskAndTag.

public JcePBEKeyEncryptionMethodGenerator

Returns:

the current generator.
setProvider
(Provider
the JCE provider to use.
provider
)

Sets the JCE provider to source cryptographic primitives from.

public JcePBEKeyEncryptionMethodGenerator

Returns:

the current generator.
setProvider
(String
the name of the JCE provider to use.
providerName
)

Sets the JCE provider to source cryptographic primitives from.

public PBEKeyEncryptionMethodGenerator
Inherited from org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator:
generategetKeygetSessionKeyWrapperAlgorithmsetSessionKeyWrapperAlgorithm

Field Detail

helperback to summary
private OperatorHelper helper

Constructor Detail

JcePBEKeyEncryptionMethodGeneratorback to summary
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator)

Create a PBE encryption method generator using the provided digest and the default S2K count for key generation.

Parameters
passPhrase:char[]

the passphrase to use as the primary source of key material.

s2kDigestCalculator:PGPDigestCalculator

the digest calculator to use for key calculation.

JcePBEKeyEncryptionMethodGeneratorback to summary
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase)

Create a PBE encryption method generator using the default SHA-1 digest and the default S2K count for key generation.

Parameters
passPhrase:char[]

the passphrase to use as the primary source of key material.

JcePBEKeyEncryptionMethodGeneratorback to summary
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, PGPDigestCalculator s2kDigestCalculator, int s2kCount)

Create a PBE encryption method generator using the provided calculator and S2K count for key generation.

Parameters
passPhrase:char[]

the passphrase to use as the primary source of key material.

s2kDigestCalculator:PGPDigestCalculator

the digest calculator to use for key calculation.

s2kCount:int

the single byte S2K count to use.

JcePBEKeyEncryptionMethodGeneratorback to summary
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, int s2kCount)

Create a PBE encryption method generator using the default SHA-1 digest calculator and a S2K count other than the default for key generation.

Parameters
passPhrase:char[]

the passphrase to use as the primary source of key material.

s2kCount:int

the single byte S2K count to use.

JcePBEKeyEncryptionMethodGeneratorback to summary
public JcePBEKeyEncryptionMethodGenerator(char[] passPhrase, S2K.Argon2Params params)

Method Detail

encryptSessionInfoback to summary
protected byte[] encryptSessionInfo(int encAlgorithm, byte[] key, byte[] sessionInfo) throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.encryptSessionInfo.

generateV6KEKback to summary
protected byte[] generateV6KEK(int kekAlgorithm, byte[] ikm, byte[] info)

Implements abstract org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.generateV6KEK.

getEskAndTagback to summary
protected byte[] getEskAndTag(int kekAlgorithm, int aeadAlgorithm, byte[] sessionKey, byte[] key, byte[] iv, byte[] info) throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.getEskAndTag.

setProviderback to summary
public JcePBEKeyEncryptionMethodGenerator setProvider(Provider provider)

Sets the JCE provider to source cryptographic primitives from.

Parameters
provider:Provider

the JCE provider to use.

Returns:JcePBEKeyEncryptionMethodGenerator

the current generator.

setProviderback to summary
public JcePBEKeyEncryptionMethodGenerator setProvider(String providerName)

Sets the JCE provider to source cryptographic primitives from.

Parameters
providerName:String

the name of the JCE provider to use.

Returns:JcePBEKeyEncryptionMethodGenerator

the current generator.

setSecureRandomback to summary
public PBEKeyEncryptionMethodGenerator setSecureRandom(SecureRandom random)

Overrides org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.setSecureRandom.

Doc from org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator.setSecureRandom.

Sets a user defined source of randomness.

If no SecureRandom is configured, a default SecureRandom will be used.

Returns:PBEKeyEncryptionMethodGenerator

the current generator.