Package es.gob.afirma.tsl.utils
Class UtilsAESCipher
- java.lang.Object
-
- es.gob.afirma.tsl.utils.UtilsAESCipher
-
public final class UtilsAESCipher extends java.lang.ObjectClass to decode and encode password using AES algorithm.
Project:Platform for detection and validation of certificates recognized in European TSL.
- Version:
- 1.1, 15/06/2021.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decryptMessage(java.lang.String msg)Method that decrypts a message.byte[]encryptMessage(java.lang.String msg)Method that encrypts a message.static UtilsAESCipherforceReloadInstance()Method that forces to reload the instance of the class.static UtilsAESCiphergetInstance()Method that obtains an instance of the class.static booleantestCipher(java.lang.String newAES)Method that checks a new key.
-
-
-
Method Detail
-
getInstance
public static UtilsAESCipher getInstance()
Method that obtains an instance of the class.- Returns:
- an instance of the class.
-
forceReloadInstance
public static UtilsAESCipher forceReloadInstance()
Method that forces to reload the instance of the class.- Returns:
- the reloaded instance of the class.
-
testCipher
public static boolean testCipher(java.lang.String newAES)
Method that checks a new key.- Parameters:
newAES- The new key.- Returns:
trueif the key is valid, otherwisefalse.
-
encryptMessage
public byte[] encryptMessage(java.lang.String msg) throws CipherExceptionMethod that encrypts a message.- Parameters:
msg- The message to encrypt.- Returns:
- the message encrypted.
- Throws:
CipherException- If the method fails.
-
decryptMessage
public byte[] decryptMessage(java.lang.String msg) throws CipherExceptionMethod that decrypts a message.- Parameters:
msg- The message to decrypt in base 64.- Returns:
- the message decrypted.
- Throws:
CipherException- If the method fails.
-
-