Bouncy Castle Cryptography Library 1.57
org.bouncycastle.openpgp.operator

Class PBEKeyEncryptionMethodGenerator

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      protected abstract byte[] encryptSessionInfo(int encAlgorithm, byte[] key, byte[] sessionInfo) 
      ContainedPacket generate(int encAlgorithm, byte[] sessionInfo)
      Generates a packet encoding the details of this encryption method.
      byte[] getKey(int encAlgorithm)
      Generate a key for a symmetric encryption algorithm using the PBE configuration in this method.
      PBEKeyEncryptionMethodGenerator setSecureRandom(java.security.SecureRandom random)
      Sets a user defined source of randomness.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PBEKeyEncryptionMethodGenerator

        protected PBEKeyEncryptionMethodGenerator(char[] passPhrase,
                                       PGPDigestCalculator s2kDigestCalculator)
        Construct a PBE key generator using the default iteration count (0x60 == 65536 iterations).
        Parameters:
        passPhrase - the pass phrase to encrypt with.
        s2kDigestCalculator - a digest calculator to use in the string-to-key function.
      • PBEKeyEncryptionMethodGenerator

        protected PBEKeyEncryptionMethodGenerator(char[] passPhrase,
                                       PGPDigestCalculator s2kDigestCalculator,
                                       int s2kCount)
        Construct a PBE key generator using a specific iteration level.
        Parameters:
        passPhrase - the pass phrase to encrypt with.
        s2kDigestCalculator - a digest calculator to use in the string-to-key function.
        s2kCount - a single byte S2K iteration count specifier, which is translated to an actual iteration count by the S2K class.
    • Method Detail

      • setSecureRandom

        public PBEKeyEncryptionMethodGenerator setSecureRandom(java.security.SecureRandom random)
        Sets a user defined source of randomness.

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

        Returns:
        the current generator.
      • getKey

        public byte[] getKey(int encAlgorithm)
                      throws PGPException
        Generate a key for a symmetric encryption algorithm using the PBE configuration in this method.
        Parameters:
        encAlgorithm - the encryption algorithm to generate the key for.
        Returns:
        the bytes of the generated key.
        Throws:
        PGPException - if an error occurs performing the string-to-key generation.
      • encryptSessionInfo

        protected abstract byte[] encryptSessionInfo(int encAlgorithm,
                                byte[] key,
                                byte[] sessionInfo)
                                              throws PGPException
        Throws:
        PGPException
Bouncy Castle Cryptography Library 1.57