@Test(timeout=120000) public void testGetInstance() throws Exception { Assume.assumeTrue(OpensslCipher.getLoadingFailureReason() == null); OpensslCipher cipher = OpensslCipher.getInstance("AES/CTR/NoPadding"); Assert.assertTrue(cipher != null); try { cipher = OpensslCipher.getInstance("AES2/CTR/NoPadding"); Assert.fail("Should specify correct algorithm."); } catch (NoSuchAlgorithmException e) { } try { cipher = OpensslCipher.getInstance("AES/CTR/NoPadding2"); Assert.fail("Should specify correct padding."); } catch (NoSuchPaddingException e) { } }
public static final OpensslCipher getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { Transform transform = tokenizeTransformation(transformation); int algMode = AlgMode.get(transform.alg, transform.mode); int padding = Padding.get(transform.padding); long context = initContext(algMode, padding); return new OpensslCipher(context, algMode, padding); }
OpensslCipher { public static final OpensslCipher getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { Transform transform = tokenizeTransformation(transformation); int algMode = AlgMode.get(transform.alg, transform.mode); int padding = Padding.get(transform.padding); long context = initContext(algMode, padding); return new OpensslCipher(context, algMode, padding); } }
OpensslCipher { public static final OpensslCipher getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { Transform transform = tokenizeTransformation(transformation); int algMode = AlgMode.get(transform.alg, transform.mode); int padding = Padding.get(transform.padding); long context = initContext(algMode, padding); return new OpensslCipher(context, algMode, padding); } private  OpensslCipher(long context, int alg, int padding); }
OpensslCipher { public static final OpensslCipher getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { Transform transform = tokenizeTransformation(transformation); int algMode = AlgMode.get(transform.alg, transform.mode); int padding = Padding.get(transform.padding); long context = initContext(algMode, padding); return new OpensslCipher(context, algMode, padding); } private  OpensslCipher(long context, int alg, int padding); static String getLoadingFailureReason(); static final OpensslCipher getInstance(String transformation); void init(int mode, byte[] key, byte[] iv); int update(ByteBuffer input, ByteBuffer output); int doFinal(ByteBuffer output); void clean(); native static String getLibraryName(); }
OpensslCipher { public static final OpensslCipher getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { Transform transform = tokenizeTransformation(transformation); int algMode = AlgMode.get(transform.alg, transform.mode); int padding = Padding.get(transform.padding); long context = initContext(algMode, padding); return new OpensslCipher(context, algMode, padding); } private  OpensslCipher(long context, int alg, int padding); static String getLoadingFailureReason(); static final OpensslCipher getInstance(String transformation); void init(int mode, byte[] key, byte[] iv); int update(ByteBuffer input, ByteBuffer output); int doFinal(ByteBuffer output); void clean(); native static String getLibraryName(); static final int ENCRYPT_MODE; static final int DECRYPT_MODE; }