Example usage for org.apache.hadoop.hdfs.security.token.block DataEncryptionKey DataEncryptionKey

List of usage examples for org.apache.hadoop.hdfs.security.token.block DataEncryptionKey DataEncryptionKey

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.security.token.block DataEncryptionKey DataEncryptionKey.

Prototype

public DataEncryptionKey(int keyId, String blockPoolId, byte[] nonce, byte[] encryptionKey, long expiryDate,
            String encryptionAlgorithm) 

Source Link

Usage

From source file:io.hops.metadata.security.token.block.NameNodeBlockTokenSecretManager.java

License:Apache License

@Override
public DataEncryptionKey generateDataEncryptionKey() throws IOException {
    byte[] nonce = new byte[8];
    nonceGenerator.nextBytes(nonce);/*from   www .  ja v a 2  s . c  o  m*/
    BlockKey key = getBlockKeyByType(BlockKey.KeyType.CurrKey);

    byte[] encryptionKey = createPassword(nonce, key.getKey());
    return new DataEncryptionKey(key.getKeyId(), blockPoolId, nonce, encryptionKey, Time.now() + tokenLifetime,
            encryptionAlgorithm);
}