Package sonia.scm.security
Class DefaultCipherHandler
java.lang.Object
sonia.scm.security.DefaultCipherHandler
- All Implemented Interfaces:
CipherHandler
Default implementation of the
CipherHandler
, which uses AES for
encryption and decryption.- Since:
- 1.7
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructs a new DefaultCipherHandler.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 theKeyGenerator
. -
Method Summary
Modifier and TypeMethodDescriptionDecodes the given value with the provided key.Decrypts the given value.Encrypts the given value with the provided key.Encrypts the given value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface sonia.scm.security.CipherHandler
decode, encode
-
Field Details
-
OLD_CIPHER_TYPE
Cipher type used before v2.- See Also:
-
CIPHER_TYPE
used cipher type for format v2- See Also:
-
PREFIX_FORMAT_V2
prefix to detect new format- See Also:
-
DIGEST_TYPE
- See Also:
-
ENCODING
-
KEY_LENGTH
public static final int KEY_LENGTH- See Also:
-
SALT_LENGTH
public static final int SALT_LENGTH- See Also:
-
-
Constructor Details
-
DefaultCipherHandler
Constructs a new DefaultCipherHandler. Note this constructor is only for unit tests.- Parameters:
key
- default encryption key- Since:
- 1.38
-
DefaultCipherHandler
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 theKeyGenerator
.- Parameters:
context
- SCM-Manager context providerkeyGenerator
- key generator for default key generation
-
-
Method Details
-
decode
Description copied from interface:CipherHandler
Decrypts the given value.- Specified by:
decode
in interfaceCipherHandler
-
decode
Decodes the given value with the provided key.- Parameters:
plainKey
- key which is used for decodingvalue
- encrypted value
-
encode
Description copied from interface:CipherHandler
Encrypts the given value.- Specified by:
encode
in interfaceCipherHandler
-
encode
Encrypts the given value with the provided key.- Parameters:
plainKey
- key which is used for encodingvalue
- plain text value to encrypt
-