Java Code Examples for org.apache.hadoop.crypto.key.KeyProvider#flush()

The following examples show how to use org.apache.hadoop.crypto.key.KeyProvider#flush() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestOzoneAtRestEncryption.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
private static void createKey(String keyName, KeyProvider
    provider, OzoneConfiguration config)
    throws NoSuchAlgorithmException, IOException {
  final KeyProvider.Options options = KeyProvider.options(config);
  options.setDescription(keyName);
  options.setBitLength(128);
  provider.createKey(keyName, options);
  provider.flush();
}
 
Example 2
Source File: TestCryptoAdminCLI.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void createAKey(String keyName, Configuration conf)
throws NoSuchAlgorithmException, IOException {
final KeyProvider provider =
    dfsCluster.getNameNode().getNamesystem().getProvider();
final KeyProvider.Options options = KeyProvider.options(conf);
provider.createKey(keyName, options);
provider.flush();
}
 
Example 3
Source File: DFSTestUtil.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to create a key in the Key Provider.
 *
 * @param keyName The name of the key to create
 * @param cluster The cluster to create it in
 * @param idx The NameNode index
 * @param conf Configuration to use
 */
public static void createKey(String keyName, MiniDFSCluster cluster,
                             int idx, Configuration conf)
    throws NoSuchAlgorithmException, IOException {
  NameNode nn = cluster.getNameNode(idx);
  KeyProvider provider = nn.getNamesystem().getProvider();
  final KeyProvider.Options options = KeyProvider.options(conf);
  options.setDescription(keyName);
  options.setBitLength(128);
  provider.createKey(keyName, options);
  provider.flush();
}
 
Example 4
Source File: TestCryptoAdminCLI.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void createAKey(String keyName, Configuration conf)
throws NoSuchAlgorithmException, IOException {
final KeyProvider provider =
    dfsCluster.getNameNode().getNamesystem().getProvider();
final KeyProvider.Options options = KeyProvider.options(conf);
provider.createKey(keyName, options);
provider.flush();
}
 
Example 5
Source File: DFSTestUtil.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to create a key in the Key Provider.
 *
 * @param keyName The name of the key to create
 * @param cluster The cluster to create it in
 * @param idx The NameNode index
 * @param conf Configuration to use
 */
public static void createKey(String keyName, MiniDFSCluster cluster,
                             int idx, Configuration conf)
    throws NoSuchAlgorithmException, IOException {
  NameNode nn = cluster.getNameNode(idx);
  KeyProvider provider = nn.getNamesystem().getProvider();
  final KeyProvider.Options options = KeyProvider.options(conf);
  options.setDescription(keyName);
  options.setBitLength(128);
  provider.createKey(keyName, options);
  provider.flush();
}
 
Example 6
Source File: TestSaslFanOutOneBlockAsyncDFSOutput.java    From hbase with Apache License 2.0 5 votes vote down vote up
private static void setUpKeyProvider(Configuration conf) throws Exception {
  URI keyProviderUri =
    new URI("jceks://file" + UTIL.getDataTestDir("test.jks").toUri().toString());
  conf.set("dfs.encryption.key.provider.uri", keyProviderUri.toString());
  KeyProvider keyProvider = KeyProviderFactory.get(keyProviderUri, conf);
  keyProvider.createKey(TEST_KEY_NAME, KeyProvider.options(conf));
  keyProvider.flush();
  keyProvider.close();
}