Skip to content

Instantly share code, notes, and snippets.

@Jaymo
Created February 29, 2016 10:22

Revisions

  1. Jaymo created this gist Feb 29, 2016.
    12 changes: 12 additions & 0 deletions createCipher.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    public static Cipher createCipher(int mode,SecretKey key,String iv) throws Exception {

    Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", "BC");

    cipher.init(
    Cipher.DECRYPT_MODE,
    new SecretKeySpec(key, "AES"),
    new IvParameterSpec(Util.HexEncoder.toByte(iv))
    );


    }