public static Key unwrapKey(Configuration conf, String subject, byte[] value)
    throws IOException, KeyException {
    EncryptionProtos.WrappedKey wrappedKey =
      EncryptionProtos.WrappedKey.parser().parseDelimitedFrom(new ByteArrayInputStream(value));
    String algorithm = conf.get(HConstants.CRYPTO_KEY_ALGORITHM_CONF_KEY, HConstants.CIPHER_AES);
    Cipher cipher = Encryption.getCipher(conf, algorithm);
    if (cipher == null) {
      throw new RuntimeException("Cipher '" + algorithm + "' not available");
    }
    return getUnwrapKey(conf, subject, wrappedKey, cipher);
  }
Unwrap a key by decrypting it with the secret key of the given subject. The configuration must
be set up correctly for key alias resolution.
@param conf    configuration
@param subject subject key alias
@param value   the encrypted key bytes
@return the raw key bytes
hbase-client/src/main/java/org/apache/hadoop/hbase/security/EncryptionUtil.java