Class EncryptionServiceImpl

java.lang.Object
ddf.security.encryption.impl.EncryptionServiceImpl
All Implemented Interfaces:
ddf.security.encryption.EncryptionService, org.apache.wss4j.common.crypto.PasswordEncryptor

public class EncryptionServiceImpl extends Object implements ddf.security.encryption.EncryptionService
  • Constructor Details

    • EncryptionServiceImpl

      public EncryptionServiceImpl()
  • Method Details

    • encrypt

      public String encrypt(String plainTextValue)
      Encrypts a plain text value. Returns no-op in the case of a problem.
      Specified by:
      encrypt in interface org.apache.wss4j.common.crypto.PasswordEncryptor
      Parameters:
      plainTextValue - The value to encrypt.
    • decrypt

      public String decrypt(String encryptedValue)
      Decrypts a plain text value. Returns no-op in the case of a problem.
      Specified by:
      decrypt in interface org.apache.wss4j.common.crypto.PasswordEncryptor
      Parameters:
      encryptedValue - The value to decrypt.
    • encryptValue

      public String encryptValue(String unwrappedPlaintext)
      
       One can encrypt passwords using the security:encrypt console command.
      
       user@local>security:encrypt secret
       c+GitDfYAMTDRESXSDDsMw==
      
       A wrapped encrypted password is wrapped in ENC() as follows: ENC(HsOcGt8seSKc34sRUYpakQ==)
      
       
      Specified by:
      encryptValue in interface ddf.security.encryption.EncryptionService
    • decryptValue

      public String decryptValue(String wrappedEncryptedValue)
      Specified by:
      decryptValue in interface ddf.security.encryption.EncryptionService
    • unwrapEncryptedValue

      public String unwrapEncryptedValue(String wrappedEncryptedValue)

      Given a string that starts with 'ENC(' and ends with ')', returns the in-between substring. This method is meant to remove the wrapping notation for encrypted values, typically passwords.

      If the input is a password and is not in the form ENC(my-encrypted-password), we assume the password is not encrypted. Returns a no-op in the case of a problem.

      Specified by:
      unwrapEncryptedValue in interface ddf.security.encryption.EncryptionService
      Parameters:
      wrappedEncryptedValue - The wrapped encrypted value, in the form 'ENC(my-encrypted-value)'.
      Returns:
      The value within the parenthesis.