Skip to content

Instantly share code, notes, and snippets.

@emboss
Last active December 10, 2015 17:58
Show Gist options
  • Save emboss/4470795 to your computer and use it in GitHub Desktop.
Save emboss/4470795 to your computer and use it in GitHub Desktop.

Revisions

  1. emboss revised this gist Jan 6, 2013. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions TestPolicyFiles.java
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    package testpolicyfiles;

    import javax.crypto.Cipher;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
  2. emboss created this gist Jan 6, 2013.
    20 changes: 20 additions & 0 deletions TestPolicyFiles.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    package testpolicyfiles;

    import javax.crypto.Cipher;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;

    public class TestPolicyFiles {

    public static void main(String[] args) {
    try {
    KeyGenerator keygen = KeyGenerator.getInstance("AES");
    keygen.init(256);
    SecretKey key = keygen.generateKey();
    Cipher aes = Cipher.getInstance("AES/CBC/PKCS5PAdding");
    aes.init(Cipher.ENCRYPT_MODE, key);
    } catch (Exception ex) {
    throw new RuntimeException(ex);
    }
    }
    }