public final class SecurityFunctions extends Object
Constructor and Description |
---|
SecurityFunctions() |
Modifier and Type | Method and Description |
---|---|
String |
decryptAES(byte[] cipherBytes,
SecretKey key)
Applies an AES decryption on the byte array
cipherBytes with they given key. |
byte[] |
encryptAES(String plainText,
SecretKey key)
Applies an AES encryption on the string
plainText with they given key |
SecretKey |
generateKey()
Generates a key for the AES encryption
|
String |
sha3(String input)
Applies SHA-3 hash function on the
input string |
public SecurityFunctions()
public String sha3(String input)
input
stringinput
- the string to apply to SHA-3 hash onpublic byte[] encryptAES(String plainText, SecretKey key)
plainText
with they given key
Keys have to be generated using the generateKey()
function
plainText
- the string to encryptkey
- the key to use during the encryptionpublic String decryptAES(byte[] cipherBytes, SecretKey key)
cipherBytes
with they given key. The key has to be the same
key used during encryption, else null is returnedcipherBytes
- the byte array to decryptkey
- the key to use during the decryptionpublic SecretKey generateKey()
Copyright © 2016. All rights reserved.