Example usage for org.apache.hadoop.crypto.key KeyProvider options

List of usage examples for org.apache.hadoop.crypto.key KeyProvider options

Introduction

In this page you can find the example usage for org.apache.hadoop.crypto.key KeyProvider options.

Prototype

public static Options options(Configuration conf) 

Source Link

Document

A helper function to create an options object.

Usage

From source file:org.trustedanalytics.cfbroker.store.hdfs.service.SimpleHdfsClient.java

License:Apache License

void createEncryptionZoneKey(String key) throws NoSuchAlgorithmException, IOException {
    final KeyProvider.Options options = KeyProvider.options(fs.getConf());
    options.setDescription(key);/*  ww w. j  av  a  2  s .c o  m*/
    options.setBitLength(256);

    List<KeyProvider> providers = KeyProviderFactory.getProviders(fs.getConf());
    Preconditions.checkArgument(!providers.isEmpty(),
            "KMS configuration required for creating encryption zones");

    KeyProvider keyProvider = providers.get(0);
    keyProvider.createKey(key, options);
}