You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
897 B

  1. import java.lang.Object;
  2. import javax.crypto.Cipher;
  3. import java.security.GeneralSecurityException;
  4. import javax.crypto.NoSuchPaddingException;
  5. import java.security.NoSuchAlgorithmException;
  6. public class AESEncryption
  7. {
  8. public static void main(String[] args)
  9. {
  10. }
  11. public void encrypt()
  12. {
  13. }
  14. public static final Cipher getInstance(String transformation)
  15. {
  16. try
  17. {
  18. KeyGenerator keyGen = KeyGenerator.getInstance("AES");
  19. keyGen.init(128);
  20. SecretKey key = keyGen.generateKey();
  21. }
  22. catch(NoSuchPaddingException nspe)
  23. {
  24. System.out.println("a particular padding mechanism is requested but is not available in the environment");
  25. }
  26. catch(NoSuchAlgorithmException nsae)
  27. {
  28. System.out.println("cryptographic algorithm is requested but is not available in the environment");
  29. }
  30. }
  31. }