Package tv.hd3g.authkit.mod.service
Class CipherServiceImpl
java.lang.Object
tv.hd3g.authkit.mod.service.CipherServiceImpl
- All Implemented Interfaces:
CipherService
See https://proandroiddev.com/security-best-practices-symmetric-encryption-with-aes-in-java-7616beaaade9
-
Constructor Summary
ConstructorsConstructorDescriptionCipherServiceImpl(String base64secret, int ivSize, String transformation, int gCMParameterSpecLen) -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringbyteToString(byte[] b) byte[]cipherFromData(byte[] clearData) byte[]cipherFromString(String text) computeSHA3FromString(String text) byte[]unCipherToData(byte[] rawData) unCipherToString(byte[] rawData)
-
Constructor Details
-
CipherServiceImpl
public CipherServiceImpl(@Value("${authkit.cipher_secret}") String base64secret, @Value("${authkit.cipher_ivsize:12}") int ivSize, @Value("${authkit.cipher_transformation:AES/GCM/NoPadding}") String transformation, @Value("${authkit.cipher_GCMParameterSpecLen:128}") int gCMParameterSpecLen) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
-
Method Details
-
getSecureRandom
- Specified by:
getSecureRandomin interfaceCipherService
-
cipherFromData
public byte[] cipherFromData(byte[] clearData) - Specified by:
cipherFromDatain interfaceCipherService- Parameters:
clearData- will be wipe after call.
-
unCipherToData
public byte[] unCipherToData(byte[] rawData) - Specified by:
unCipherToDatain interfaceCipherService
-
cipherFromString
- Specified by:
cipherFromStringin interfaceCipherService
-
unCipherToString
- Specified by:
unCipherToStringin interfaceCipherService
-
byteToString
-
computeSHA3FromString
- Specified by:
computeSHA3FromStringin interfaceCipherService
-