Class DefaultCipherHandler

java.lang.Object
sonia.scm.security.DefaultCipherHandler
All Implemented Interfaces:
CipherHandler

public class DefaultCipherHandler extends Object implements CipherHandler
Default implementation of the CipherHandler, which uses AES for encryption and decryption.
Since:
1.7
  • Field Details

  • Constructor Details

    • DefaultCipherHandler

      protected DefaultCipherHandler(String key)
      Constructs a new DefaultCipherHandler. Note this constructor is only for unit tests.
      Parameters:
      key - default encryption key
      Since:
      1.38
    • DefaultCipherHandler

      public DefaultCipherHandler(SCMContextProvider context, KeyGenerator keyGenerator)
      Constructs a new instance and reads the default key from the scm home directory, if the key file does not exists it will be generated with the KeyGenerator.
      Parameters:
      context - SCM-Manager context provider
      keyGenerator - key generator for default key generation
  • Method Details

    • decode

      public String decode(String value)
      Description copied from interface: CipherHandler
      Decrypts the given value.
      Specified by:
      decode in interface CipherHandler
    • decode

      public String decode(char[] plainKey, String value)
      Decodes the given value with the provided key.
      Parameters:
      plainKey - key which is used for decoding
      value - encrypted value
    • encode

      public String encode(String value)
      Description copied from interface: CipherHandler
      Encrypts the given value.
      Specified by:
      encode in interface CipherHandler
    • encode

      public String encode(char[] plainKey, String value)
      Encrypts the given value with the provided key.
      Parameters:
      plainKey - key which is used for encoding
      value - plain text value to encrypt