Bouncy Castle Cryptography Library 1.59

org.bouncycastle.pkcs.jcajce
Class JcePKCSPBEOutputEncryptorBuilder

java.lang.Object
  extended byorg.bouncycastle.pkcs.jcajce.JcePKCSPBEOutputEncryptorBuilder

public class JcePKCSPBEOutputEncryptorBuilder
extends java.lang.Object


Constructor Summary
JcePKCSPBEOutputEncryptorBuilder(org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionAlg)
           
JcePKCSPBEOutputEncryptorBuilder(org.bouncycastle.crypto.util.PBKDFConfig pbkdfAlgorithm, org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionAlg)
          Constructor allowing different derivation functions such as PBKDF2 and scrypt.
 
Method Summary
 OutputEncryptor build(char[] password)
           
 JcePKCSPBEOutputEncryptorBuilder setIterationCount(int iterationCount)
          Set the iteration count for the PBE calculation.
 JcePKCSPBEOutputEncryptorBuilder setKeySizeProvider(SecretKeySizeProvider keySizeProvider)
          Set the lookup provider of AlgorithmIdentifier returning key_size_in_bits used to handle PKCS5 decryption.
 JcePKCSPBEOutputEncryptorBuilder setPRF(org.bouncycastle.asn1.x509.AlgorithmIdentifier prf)
          Set the PRF to use for key generation.
 JcePKCSPBEOutputEncryptorBuilder setProvider(java.security.Provider provider)
           
 JcePKCSPBEOutputEncryptorBuilder setProvider(java.lang.String providerName)
           
 JcePKCSPBEOutputEncryptorBuilder setRandom(java.security.SecureRandom random)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcePKCSPBEOutputEncryptorBuilder

public JcePKCSPBEOutputEncryptorBuilder(org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionAlg)

JcePKCSPBEOutputEncryptorBuilder

public JcePKCSPBEOutputEncryptorBuilder(org.bouncycastle.crypto.util.PBKDFConfig pbkdfAlgorithm,
                                        org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionAlg)
Constructor allowing different derivation functions such as PBKDF2 and scrypt.

Parameters:
pbkdfAlgorithm - key derivation algorithm definition to use.
keyEncryptionAlg - encryption algorithm to apply the derived key with.
Method Detail

setProvider

public JcePKCSPBEOutputEncryptorBuilder setProvider(java.security.Provider provider)

setProvider

public JcePKCSPBEOutputEncryptorBuilder setProvider(java.lang.String providerName)

setRandom

public JcePKCSPBEOutputEncryptorBuilder setRandom(java.security.SecureRandom random)

setKeySizeProvider

public JcePKCSPBEOutputEncryptorBuilder setKeySizeProvider(SecretKeySizeProvider keySizeProvider)
Set the lookup provider of AlgorithmIdentifier returning key_size_in_bits used to handle PKCS5 decryption.

Parameters:
keySizeProvider - a provider of integer secret key sizes.
Returns:
the current builder.

setPRF

public JcePKCSPBEOutputEncryptorBuilder setPRF(org.bouncycastle.asn1.x509.AlgorithmIdentifier prf)
Set the PRF to use for key generation. By default this is HmacSHA1.

Parameters:
prf - algorithm id for PRF.
Returns:
the current builder.
Throws:
java.lang.IllegalStateException - if this builder was intialised with a PBKDFDef

setIterationCount

public JcePKCSPBEOutputEncryptorBuilder setIterationCount(int iterationCount)
Set the iteration count for the PBE calculation.

Parameters:
iterationCount - the iteration count to apply to the key creation.
Returns:
the current builder.
Throws:
java.lang.IllegalStateException - if this builder was intialised with a PBKDFDef

build

public OutputEncryptor build(char[] password)
                      throws OperatorCreationException
Throws:
OperatorCreationException

Bouncy Castle Cryptography Library 1.59