public OpensslAesCtrCryptoCodec() { String loadingFailureReason = OpensslCipher.getLoadingFailureReason(); if (loadingFailureReason != null) { throw new RuntimeException(loadingFailureReason); } }
openSslDetail = OpensslCipher.getLoadingFailureReason(); if (openSslDetail != null) { openSslLoaded = false;
public OpensslAesCtrCryptoCodec() { String loadingFailureReason = OpensslCipher.getLoadingFailureReason(); if (loadingFailureReason != null) { throw new RuntimeException(loadingFailureReason); } }
public OpensslAesCtrCryptoCodec() { String loadingFailureReason = OpensslCipher.getLoadingFailureReason(); if (loadingFailureReason != null) { throw new RuntimeException(loadingFailureReason); } }
public OpensslAesCtrCryptoCodec() { String loadingFailureReason = OpensslCipher.getLoadingFailureReason(); if (loadingFailureReason != null) { throw new RuntimeException(loadingFailureReason); } }
public OpensslAesCtrCryptoCodec() { String loadingFailureReason = OpensslCipher.getLoadingFailureReason(); if (loadingFailureReason != null) { throw new RuntimeException(loadingFailureReason); } }
snappyLibraryName = SnappyCodec.getLibraryName(); if (OpensslCipher.getLoadingFailureReason() != null) { openSslDetail = OpensslCipher.getLoadingFailureReason(); openSslLoaded = false; } else {
snappyLibraryName = SnappyCodec.getLibraryName(); if (OpensslCipher.getLoadingFailureReason() != null) { openSslDetail = OpensslCipher.getLoadingFailureReason(); openSslLoaded = false; } else {
snappyLibraryName = SnappyCodec.getLibraryName(); if (OpensslCipher.getLoadingFailureReason() != null) { openSslDetail = OpensslCipher.getLoadingFailureReason(); openSslLoaded = false; } else {
if (OpensslCipher.getLoadingFailureReason() != null) { openSslDetail = OpensslCipher.getLoadingFailureReason(); openSslLoaded = false; } else {
@Test(timeout=120000) public void testUpdateArguments() throws Exception { Assume.assumeTrue(OpensslCipher.getLoadingFailureReason() == null); OpensslCipher cipher = OpensslCipher.getInstance("AES/CTR/NoPadding"); Assert.assertTrue(cipher != null);
@Test(timeout=120000) public void testUpdateArguments() throws Exception { Assume.assumeTrue(OpensslCipher.getLoadingFailureReason() == null); OpensslCipher cipher = OpensslCipher.getInstance("AES/CTR/NoPadding"); Assert.assertTrue(cipher != null);
@Test(timeout=120000) public void testDoFinalArguments() throws Exception { Assume.assumeTrue(OpensslCipher.getLoadingFailureReason() == null); OpensslCipher cipher = OpensslCipher.getInstance("AES/CTR/NoPadding"); Assert.assertTrue(cipher != null); cipher.init(OpensslCipher.ENCRYPT_MODE, key, iv); // Require direct buffer ByteBuffer output = ByteBuffer.allocate(1024); try { cipher.doFinal(output); Assert.fail("Output buffer should be direct buffer."); } catch (IllegalArgumentException e) { GenericTestUtils.assertExceptionContains( "Direct buffer is required", e); } } }
@Test(timeout=120000) public void testDoFinalArguments() throws Exception { Assume.assumeTrue(OpensslCipher.getLoadingFailureReason() == null); OpensslCipher cipher = OpensslCipher.getInstance("AES/CTR/NoPadding"); Assert.assertTrue(cipher != null); cipher.init(OpensslCipher.ENCRYPT_MODE, key, iv); // Require direct buffer ByteBuffer output = ByteBuffer.allocate(1024); try { cipher.doFinal(output); Assert.fail("Output buffer should be direct buffer."); } catch (IllegalArgumentException e) { GenericTestUtils.assertExceptionContains( "Direct buffer is required", e); } } }
@Test(timeout=120000) public void testJceAesCtrCryptoCodec() throws Exception { GenericTestUtils.assumeInNativeProfile(); if (!NativeCodeLoader.buildSupportsOpenssl()) { LOG.warn("Skipping test since openSSL library not loaded"); Assume.assumeTrue(false); } Assert.assertEquals(null, OpensslCipher.getLoadingFailureReason()); cryptoCodecTest(conf, seed, 0, jceCodecClass, jceCodecClass, iv); cryptoCodecTest(conf, seed, count, jceCodecClass, jceCodecClass, iv); cryptoCodecTest(conf, seed, count, jceCodecClass, opensslCodecClass, iv); // Overflow test, IV: xx xx xx xx xx xx xx xx ff ff ff ff ff ff ff ff for(int i = 0; i < 8; i++) { iv[8 + i] = (byte) 0xff; } cryptoCodecTest(conf, seed, count, jceCodecClass, jceCodecClass, iv); cryptoCodecTest(conf, seed, count, jceCodecClass, opensslCodecClass, iv); }
@Test(timeout=120000) public void testJceAesCtrCryptoCodec() throws Exception { GenericTestUtils.assumeInNativeProfile(); if (!NativeCodeLoader.buildSupportsOpenssl()) { LOG.warn("Skipping test since openSSL library not loaded"); Assume.assumeTrue(false); } Assert.assertEquals(null, OpensslCipher.getLoadingFailureReason()); cryptoCodecTest(conf, seed, 0, jceCodecClass, jceCodecClass, iv); cryptoCodecTest(conf, seed, count, jceCodecClass, jceCodecClass, iv); cryptoCodecTest(conf, seed, count, jceCodecClass, opensslCodecClass, iv); // Overflow test, IV: xx xx xx xx xx xx xx xx ff ff ff ff ff ff ff ff for(int i = 0; i < 8; i++) { iv[8 + i] = (byte) 0xff; } cryptoCodecTest(conf, seed, count, jceCodecClass, jceCodecClass, iv); cryptoCodecTest(conf, seed, count, jceCodecClass, opensslCodecClass, iv); }
@Test(timeout=120000) public void testOpensslAesCtrCryptoCodec() throws Exception { GenericTestUtils.assumeInNativeProfile(); if (!NativeCodeLoader.buildSupportsOpenssl()) { LOG.warn("Skipping test since openSSL library not loaded"); Assume.assumeTrue(false); } Assert.assertEquals(null, OpensslCipher.getLoadingFailureReason()); cryptoCodecTest(conf, seed, 0, opensslCodecClass, opensslCodecClass, iv); cryptoCodecTest(conf, seed, count, opensslCodecClass, opensslCodecClass, iv); cryptoCodecTest(conf, seed, count, opensslCodecClass, jceCodecClass, iv); // Overflow test, IV: xx xx xx xx xx xx xx xx ff ff ff ff ff ff ff ff for(int i = 0; i < 8; i++) { iv[8 + i] = (byte) 0xff; } cryptoCodecTest(conf, seed, count, opensslCodecClass, opensslCodecClass, iv); cryptoCodecTest(conf, seed, count, opensslCodecClass, jceCodecClass, iv); }
@Test(timeout=120000) public void testOpensslAesCtrCryptoCodec() throws Exception { GenericTestUtils.assumeInNativeProfile(); if (!NativeCodeLoader.buildSupportsOpenssl()) { LOG.warn("Skipping test since openSSL library not loaded"); Assume.assumeTrue(false); } Assert.assertEquals(null, OpensslCipher.getLoadingFailureReason()); cryptoCodecTest(conf, seed, 0, opensslCodecClass, opensslCodecClass, iv); cryptoCodecTest(conf, seed, count, opensslCodecClass, opensslCodecClass, iv); cryptoCodecTest(conf, seed, count, opensslCodecClass, jceCodecClass, iv); // Overflow test, IV: xx xx xx xx xx xx xx xx ff ff ff ff ff ff ff ff for(int i = 0; i < 8; i++) { iv[8 + i] = (byte) 0xff; } cryptoCodecTest(conf, seed, count, opensslCodecClass, opensslCodecClass, iv); cryptoCodecTest(conf, seed, count, opensslCodecClass, jceCodecClass, iv); }
@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) { // Expect NoSuchAlgorithmException } try { cipher = OpensslCipher.getInstance("AES/CTR/NoPadding2"); Assert.fail("Should specify correct padding."); } catch (NoSuchPaddingException e) { // Expect NoSuchPaddingException } }
@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) { // Expect NoSuchAlgorithmException } try { cipher = OpensslCipher.getInstance("AES/CTR/NoPadding2"); Assert.fail("Should specify correct padding."); } catch (NoSuchPaddingException e) { // Expect NoSuchPaddingException } }