public class EncryptionUtility extends Object
| Constructor and Description |
|---|
EncryptionUtility() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decrypt(Key key,
byte[] toBeDecrypted) |
static byte[] |
decrypt(Key key,
byte[] toBeDecrypted,
AlgorithmParameterSpec algorithmParameterSpec) |
static byte[] |
decrypt(Key key,
String specificAlgorithm,
byte[] toBeDecrypted) |
static byte[] |
decrypt(Key key,
String specificAlgorithm,
byte[] toBeDecrypted,
AlgorithmParameterSpec algorithmParameterSpec) |
static Key |
deserializeKey(byte[] keyBytes) |
static byte[] |
encrypt(Key key,
byte[] toBeEncrypted) |
static byte[] |
encrypt(Key key,
byte[] toBeEncrypted,
AlgorithmParameterSpec algorithmParameterSpec) |
static byte[] |
encrypt(Key key,
String specificAlgorithm,
byte[] toBeEncrypted) |
static byte[] |
encrypt(Key key,
String specificAlgorithm,
byte[] toBeEncrypted,
AlgorithmParameterSpec algorithmParameterSpec) |
static Key |
generateKey(SymmetricAlgorithm algorithm) |
static KeyPair |
generateKeyPair(AsymmetricAlgorithm algorithm) |
static byte[] |
hash(HashAlgorithm algorithm,
byte[] toBeHashed) |
static byte[] |
hexDecode(String toBeDecoded) |
static String |
hexEncode(byte[] bytes) |
static String |
hexEncode(byte[] bytes,
int offset,
int length) |
static byte[] |
serializeKey(Key key) |
static byte[] |
sign(HMACSigningAlgorithm algorithm,
Key secretKey,
byte[] data) |
static byte[] |
sign(RSASigningAlgorithm algorithm,
PrivateKey privateKey,
byte[] data) |
static boolean |
verify(RSASigningAlgorithm algorithm,
PublicKey publicKey,
byte[] data,
byte[] signedData) |
public static String hexEncode(byte[] bytes)
public static String hexEncode(byte[] bytes, int offset, int length)
public static byte[] hexDecode(String toBeDecoded)
public static byte[] hash(HashAlgorithm algorithm, byte[] toBeHashed) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic static byte[] sign(HMACSigningAlgorithm algorithm, Key secretKey, byte[] data) throws NoSuchAlgorithmException, InvalidKeyException
public static byte[] sign(RSASigningAlgorithm algorithm, PrivateKey privateKey, byte[] data) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
public static boolean verify(RSASigningAlgorithm algorithm, PublicKey publicKey, byte[] data, byte[] signedData) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
public static Key generateKey(SymmetricAlgorithm algorithm) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic static KeyPair generateKeyPair(AsymmetricAlgorithm algorithm) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic static byte[] serializeKey(Key key) throws IOException
IOExceptionpublic static Key deserializeKey(byte[] keyBytes) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static byte[] encrypt(Key key, byte[] toBeEncrypted) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] encrypt(Key key, String specificAlgorithm, byte[] toBeEncrypted) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] encrypt(Key key, byte[] toBeEncrypted, AlgorithmParameterSpec algorithmParameterSpec) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] encrypt(Key key, String specificAlgorithm, byte[] toBeEncrypted, AlgorithmParameterSpec algorithmParameterSpec) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] decrypt(Key key, byte[] toBeDecrypted) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] decrypt(Key key, String specificAlgorithm, byte[] toBeDecrypted) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] decrypt(Key key, byte[] toBeDecrypted, AlgorithmParameterSpec algorithmParameterSpec) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
public static byte[] decrypt(Key key, String specificAlgorithm, byte[] toBeDecrypted, AlgorithmParameterSpec algorithmParameterSpec) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
Copyright © 2019. All rights reserved.