Package org.wildfly.security.encryption
Class CipherUtil
- java.lang.Object
-
- org.wildfly.security.encryption.CipherUtil
-
public class CipherUtil extends Object
A utility for usingCipher
instances to encrypt and encode as well as decode and decrypt clear text Strings.- Author:
- Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private static String
TRANSFORMATION
-
Constructor Summary
Constructors Constructor Description CipherUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
decrypt(byte[] token, SecretKey secretKey)
static String
decrypt(String token, SecretKey secretKey)
private static byte[]
decrypt(org.wildfly.common.iteration.ByteIterator byteIterator, SecretKey secretKey)
static byte[]
encrypt(byte[] clearBytes, SecretKey secretKey)
static String
encrypt(String clearText, SecretKey secretKey)
-
-
-
Field Detail
-
TRANSFORMATION
private static final String TRANSFORMATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
encrypt
public static String encrypt(String clearText, SecretKey secretKey) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
encrypt
public static byte[] encrypt(byte[] clearBytes, SecretKey secretKey) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
decrypt
public static String decrypt(String token, SecretKey secretKey) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
decrypt
public static byte[] decrypt(byte[] token, SecretKey secretKey) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
decrypt
private static byte[] decrypt(org.wildfly.common.iteration.ByteIterator byteIterator, SecretKey secretKey) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
-