Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st. We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here. Need help or have questions? Drop us a line at [email protected]
A customer recently asked about the security capabilities of HIVE with regards to masking and encrypting specific fields within a HIVE table. After some research, I found that there are 4 such UDFs already available in the HIVE 1.3 release. Unfortunately, the customer was using HDP 2.3.0, which ships with HIVE 0.14, and thus they did NOT have access to these UDFs.
Being the impatient type, and not wanting to reinvent the wheel, I created a simple github project to back-port these UDFs into, which can be found here: https://github.com/davidkj69/Backported-UDFs
Then, I harvested the code from the Apache HIVE 1.3 trunk and added it to the repo, changed the library versions to Hive 0.14, and ran mvn build to generate the Backported-UDFs-0.0.1.jar, which I loaded onto HDFS in the /user/davidk directory. I then was able to test all of the functions as follows:
hive> add jar Backported-UDFs-0.0.1.jar;
hive> CREATE function sha1 AS 'org.apache.hadoop.hive.ql.udf.UDFSha1' USING JAR 'hdfs:///user/davidk/Backported-UDFs-0.0.1.jar';
hive> select sha1('ABC');
hive> CREATE function aes_encrypt AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFAesEncrypt' USING JAR 'hdfs:///user/davidk/Backported-UDFs-0.0.1.jar';
hive> CREATE function aes_decrypt AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFAesDecrypt' USING JAR 'hdfs:///user/davidk/Backported-UDFs-0.0.1.jar';