Hi If you have access to Hadoop codebase, take a look at CryptoAdmin class, which implements these two commands. Internally, the commands are implemented via DistributedFileSystem#createEncryptionZone and DistributedFileSystem#listEncryptionZones
Regards, Wei-Chiu Chuang A very happy Clouderan > On Dec 14, 2016, at 5:39 AM, Aneela Saleem <ane...@platalytics.com> wrote: > > Hi, > > I have successfully enables Hadoop with KMS and now I want to write some java > code to create key, get keys and encrypt a directory using a key. In other > words, I want to translate this command > > hdfs hdfs crypto -createZone -keyName <key_name> -path /encryption_zone > and > hdfs hdfs crypto -listZones > > into java code. > > > Any suggestions will be appreciated. > > Thanks