Package com.github.damianwajser.crypto
Class CryptoUtil
- java.lang.Object
-
- com.github.damianwajser.crypto.CryptoUtil
-
public class CryptoUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description CryptoUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdecrypt(String secretKey, String encryptedText)Stringencrypt(String secretKey, String plainText)static voidmain(String[] args)
-
-
-
Method Detail
-
encrypt
public String encrypt(String secretKey, String plainText) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, UnsupportedEncodingException, IllegalBlockSizeException, BadPaddingException
- Parameters:
secretKey- Key used to encrypt dataplainText- Text input to be encrypted- Returns:
- Returns encrypted text
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptionNoSuchPaddingExceptionInvalidKeyExceptionInvalidAlgorithmParameterExceptionUnsupportedEncodingExceptionIllegalBlockSizeExceptionBadPaddingException
-
decrypt
public String decrypt(String secretKey, String encryptedText) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, UnsupportedEncodingException, IllegalBlockSizeException, BadPaddingException, IOException
- Parameters:
secretKey- Key used to decrypt dataencryptedText- encrypted text input to decrypt- Returns:
- Returns plain text after decryption
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptionNoSuchPaddingExceptionInvalidKeyExceptionInvalidAlgorithmParameterExceptionUnsupportedEncodingExceptionIllegalBlockSizeExceptionBadPaddingExceptionIOException
-
-