Java 类org.apache.hadoop.hbase.io.crypto.DefaultCipherProvider 实例源码

项目:ditb    文件:EncryptionTest.java   
/**
 * Check that the configured cipher provider can be loaded and initialized, or
 * throw an exception.
 *
 * @param conf
 * @throws IOException
 */
public static void testCipherProvider(final Configuration conf) throws IOException {
  String providerClassName = conf.get(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY,
    DefaultCipherProvider.class.getName());
  Boolean result = cipherProviderResults.get(providerClassName);
  if (result == null) {
    try {
      Encryption.getCipherProvider(conf);
      cipherProviderResults.put(providerClassName, true);
    } catch (Exception e) { // most likely a RuntimeException
      cipherProviderResults.put(providerClassName, false);
      throw new IOException("Cipher provider " + providerClassName + " failed test: " +
        e.getMessage(), e);
    }
  } else if (result.booleanValue() == false) {
    throw new IOException("Cipher provider " + providerClassName + " previously failed test");
  }
}
项目:pbase    文件:EncryptionTest.java   
/**
 * Check that the configured cipher provider can be loaded and initialized, or
 * throw an exception.
 *
 * @param conf
 * @throws IOException
 */
public static void testCipherProvider(final Configuration conf) throws IOException {
  String providerClassName = conf.get(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY,
    DefaultCipherProvider.class.getName());
  Boolean result = cipherProviderResults.get(providerClassName);
  if (result == null) {
    try {
      Encryption.getCipherProvider(conf);
      cipherProviderResults.put(providerClassName, true);
    } catch (Exception e) { // most likely a RuntimeException
      cipherProviderResults.put(providerClassName, false);
      throw new IOException("Cipher provider " + providerClassName + " failed test: " +
        e.getMessage(), e);
    }
  } else if (result.booleanValue() == false) {
    throw new IOException("Cipher provider " + providerClassName + " previously failed test");
  }
}
项目:hbase    文件:EncryptionTest.java   
/**
 * Check that the configured cipher provider can be loaded and initialized, or
 * throw an exception.
 *
 * @param conf
 * @throws IOException
 */
public static void testCipherProvider(final Configuration conf) throws IOException {
  String providerClassName = conf.get(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY,
    DefaultCipherProvider.class.getName());
  Boolean result = cipherProviderResults.get(providerClassName);
  if (result == null) {
    try {
      Encryption.getCipherProvider(conf);
      cipherProviderResults.put(providerClassName, true);
    } catch (Exception e) { // most likely a RuntimeException
      cipherProviderResults.put(providerClassName, false);
      throw new IOException("Cipher provider " + providerClassName + " failed test: " +
        e.getMessage(), e);
    }
  } else if (result.booleanValue() == false) {
    throw new IOException("Cipher provider " + providerClassName + " previously failed test");
  }
}
项目:ditb    文件:TestAES.java   
@Test
public void testAlternateRNG() throws Exception {
  Security.addProvider(new TestProvider());

  Configuration conf = new Configuration();
  conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG");
  conf.set(AES.RNG_PROVIDER_KEY, "TEST");
  DefaultCipherProvider.getInstance().setConf(conf);

  AES aes = new AES(DefaultCipherProvider.getInstance());
  assertEquals("AES did not find alternate RNG", aes.getRNG().getAlgorithm(),
    "TestRNG");
}
项目:pbase    文件:TestAES.java   
@Test
public void testAlternateRNG() throws Exception {
  Security.addProvider(new TestProvider());

  Configuration conf = new Configuration();
  conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG");
  conf.set(AES.RNG_PROVIDER_KEY, "TEST");
  DefaultCipherProvider.getInstance().setConf(conf);

  AES aes = new AES(DefaultCipherProvider.getInstance());
  assertEquals("AES did not find alternate RNG", aes.getRNG().getAlgorithm(),
    "TestRNG");
}
项目:HIndex    文件:TestAES.java   
@Test
public void testAlternateRNG() throws Exception {
  Security.addProvider(new TestProvider());

  Configuration conf = new Configuration();
  conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG");
  conf.set(AES.RNG_PROVIDER_KEY, "TEST");
  DefaultCipherProvider.getInstance().setConf(conf);

  AES aes = new AES(DefaultCipherProvider.getInstance());
  assertEquals("AES did not find alternate RNG", aes.getRNG().getAlgorithm(),
    "TestRNG");
}
项目:hbase    文件:HFilePerformanceEvaluation.java   
private String getCipherName(Configuration conf, String cipherName) {
  if (cipherName.equals("aes")) {
    String provider = conf.get(HConstants.CRYPTO_CIPHERPROVIDER_CONF_KEY);
    if (provider == null || provider.equals("")
            || provider.equals(DefaultCipherProvider.class.getName())) {
      return "aes-default";
    } else if (provider.equals(CryptoCipherProvider.class.getName())) {
      return "aes-commons";
    }
  }
  return cipherName;
}
项目:hbase    文件:TestAES.java   
@Test
public void testAlternateRNG() throws Exception {
  Security.addProvider(new TestProvider());

  Configuration conf = new Configuration();
  conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG");
  conf.set(AES.RNG_PROVIDER_KEY, "TEST");
  DefaultCipherProvider.getInstance().setConf(conf);

  AES aes = new AES(DefaultCipherProvider.getInstance());
  assertEquals("AES did not find alternate RNG", "TestRNG", aes.getRNG().getAlgorithm());
}
项目:hbase    文件:TestCommonsAES.java   
@Test
public void testAlternateRNG() throws Exception {
  Security.addProvider(new TestProvider());

  Configuration conf = new Configuration();
  conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG");
  conf.set(AES.RNG_PROVIDER_KEY, "TEST");
  DefaultCipherProvider.getInstance().setConf(conf);

  AES aes = new AES(DefaultCipherProvider.getInstance());
  assertEquals("AES did not find alternate RNG", "TestRNG", aes.getRNG().getAlgorithm());
}
项目:PyroDB    文件:TestAES.java   
@Test
public void testAlternateRNG() throws Exception {
  Security.addProvider(new TestProvider());

  Configuration conf = new Configuration();
  conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG");
  conf.set(AES.RNG_PROVIDER_KEY, "TEST");
  DefaultCipherProvider.getInstance().setConf(conf);

  AES aes = new AES(DefaultCipherProvider.getInstance());
  assertEquals("AES did not find alternate RNG", aes.getRNG().getAlgorithm(),
    "TestRNG");
}