Package tv.hd3g.authkit.mod.service
Class CipherServiceImpl
- java.lang.Object
-
- tv.hd3g.authkit.mod.service.CipherServiceImpl
-
- All Implemented Interfaces:
tv.hd3g.commons.authkit.CipherService
@Service public class CipherServiceImpl extends Object implements tv.hd3g.commons.authkit.CipherService
See https://proandroiddev.com/security-best-practices-symmetric-encryption-with-aes-in-java-7616beaaade9
-
-
Constructor Summary
Constructors Constructor Description CipherServiceImpl(String base64secret, int ivSize, String transformation, int gCMParameterSpecLen)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringbyteToString(byte[] b)byte[]cipherFromData(byte[] clearData)byte[]cipherFromString(String text)StringcomputeSHA3FromString(String text)RandomgetSecureRandom()byte[]unCipherToData(byte[] rawData)StringunCipherToString(byte[] rawData)
-
-
-
Constructor Detail
-
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 Detail
-
getSecureRandom
public Random getSecureRandom()
- Specified by:
getSecureRandomin interfacetv.hd3g.commons.authkit.CipherService
-
cipherFromData
public byte[] cipherFromData(byte[] clearData)
- Specified by:
cipherFromDatain interfacetv.hd3g.commons.authkit.CipherService
-
unCipherToData
public byte[] unCipherToData(byte[] rawData)
- Specified by:
unCipherToDatain interfacetv.hd3g.commons.authkit.CipherService
-
cipherFromString
public byte[] cipherFromString(String text)
- Specified by:
cipherFromStringin interfacetv.hd3g.commons.authkit.CipherService
-
unCipherToString
public String unCipherToString(byte[] rawData)
- Specified by:
unCipherToStringin interfacetv.hd3g.commons.authkit.CipherService
-
byteToString
public static final String byteToString(byte[] b)
-
-