Enum BouncyCastleEncryptedPrivateKeyInfoDecryptor

java.lang.Object
java.lang.Enum<BouncyCastleEncryptedPrivateKeyInfoDecryptor>
org.apache.sshd.common.util.security.bouncycastle.BouncyCastleEncryptedPrivateKeyInfoDecryptor
All Implemented Interfaces:
Serializable, Comparable<BouncyCastleEncryptedPrivateKeyInfoDecryptor>, Decryptor

public enum BouncyCastleEncryptedPrivateKeyInfoDecryptor extends Enum<BouncyCastleEncryptedPrivateKeyInfoDecryptor> implements Decryptor
Utility to decrypt an RFC 5958 PKCS#8 EncryptedPrivateKeyInfo.
  • Enum Constant Details

  • Constructor Details

    • BouncyCastleEncryptedPrivateKeyInfoDecryptor

      private BouncyCastleEncryptedPrivateKeyInfoDecryptor()
  • Method Details

    • values

      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • decrypt

      public byte[] decrypt(byte[] encrypted, char[] password) throws GeneralSecurityException
      Description copied from interface: Decryptor
      Decrypts encrypted bytes, using the given password as decryption key.

      The encrypted data must contain enough information about the encryption algorithm used so that it can be decrypted at all.

      If the password is wrong, the method may return wrongly decrypted data. If decryption fails, it may return null or throw a GeneralSecurityException.

      The caller is responsible for eventually clearing the password and the decrypted data returned.

      Specified by:
      decrypt in interface Decryptor
      Parameters:
      encrypted - data to decrypt
      password - decryption key
      Returns:
      decrypted data, possibly null if decryption failed
      Throws:
      GeneralSecurityException - may be thrown if decryption failed