Class Pem.Encryption.Builder

    • Method Detail

      • keySize

        public Pem.Encryption.Builder keySize​(int keySize)
        The encryption key-size in bits, defaults to 128
        Parameters:
        keySize - The key size in bits
        Returns:
        self
      • entropy

        public Pem.Encryption.Builder entropy​(SecureRandom entropy)
        Configure the entropy source to use for generating an initialization vector, if none explicitly specified
        Parameters:
        entropy - The source of random bytes
        Returns:
        self
      • iv

        public Pem.Encryption.Builder iv​(byte[] iv)
        The initialization vector
        Parameters:
        iv - The initialization vector
        Returns:
        self
      • blockMode

        public Pem.Encryption.Builder blockMode​(String blockMode)
        The block mode, defaults to CBC
        Parameters:
        blockMode - The block mode
        Returns:
        self
      • ownsPassphrase

        public Pem.Encryption.Builder ownsPassphrase​(boolean ownsPassphrase)
        Indicate if this instance owns the passphrase (and therefore must close/erase it, when this instance is closed)
        Parameters:
        ownsPassphrase - If true the instance will own the passphrase
        Returns:
        self
      • passphrase

        public Pem.Encryption.Builder passphrase​(char[] passphrase)
        Configure the passphrase from a character array.

        The passphrase will be erased when the Pem.Encryption instance is closed

        Parameters:
        passphrase - The pass phrase
        Returns:
        self
      • build

        public Pem.Encryption build()
        Build the Pem.Encryption instance.

        If an initialization vector has not been configured, then a random one is automatically generated

        Returns:
        Encryption instance