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

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

Introduction

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

Prototype

public KeyVersion createKey(String name, Options options) throws NoSuchAlgorithmException, IOException 

Source Link

Document

Create a new key generating the material for it.

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);//from  ww w  .  j av a 2s  .  c  om
    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);
}