Package de.narimo.georepo.server.tools
Class AESGenerator
- java.lang.Object
-
- de.narimo.georepo.server.tools.AESGenerator
-
public class AESGenerator extends Object
-
-
Constructor Summary
Constructors Constructor Description AESGenerator(String password, String salt)AESGenerator(javax.servlet.ServletContext ctx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdecrypt(String encryptedText)Decrypts an encrypted string.Stringencrypt(String text)Encrypts an input text, returning the encrypted string, prepended by the IV.static voidmain(String[] args)
-
-
-
Constructor Detail
-
AESGenerator
public AESGenerator(javax.servlet.ServletContext ctx) throws NoSuchAlgorithmException, InvalidKeySpecException
-
AESGenerator
public AESGenerator(String password, String salt) throws NoSuchAlgorithmException, InvalidKeySpecException
-
-
Method Detail
-
encrypt
public String encrypt(String text) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException, InvalidAlgorithmParameterException, BadPaddingException, IllegalBlockSizeException
Encrypts an input text, returning the encrypted string, prepended by the IV.- Parameters:
text-- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptionInvalidKeyExceptionNoSuchPaddingExceptionInvalidAlgorithmParameterExceptionBadPaddingExceptionIllegalBlockSizeException
-
decrypt
public String decrypt(String encryptedText) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, NoSuchPaddingException, InvalidAlgorithmParameterException, BadPaddingException, IllegalBlockSizeException
Decrypts an encrypted string. Assumes that the encrypted string is prepended by its IV.- Parameters:
encryptedText-- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptionInvalidKeyExceptionNoSuchPaddingExceptionInvalidAlgorithmParameterExceptionBadPaddingExceptionIllegalBlockSizeException
-
main
public static void main(String[] args) throws InvalidKeyException, NoSuchPaddingException, InvalidAlgorithmParameterException, BadPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, UnsupportedEncodingException
-
-