public static void encryptWithSubjectKey(OutputStream out, InputStream in, String subject,
    Configuration conf, Cipher cipher, byte[] iv) throws IOException {
    Key key = getSecretKeyForSubject(subject, conf);
    if (key == null) {
      throw new IOException("No key found for subject '" + subject + "'");
    }
    Encryptor e = cipher.getEncryptor();
    e.setKey(key);
    e.setIv(iv); // can be null
    encrypt(out, in, e);
  }
Encrypts a block of plaintext with the symmetric key resolved for the given subject
@param out    ciphertext
@param in     plaintext
@param conf   configuration
@param cipher the encryption algorithm
@param iv     the initialization vector, can be null
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/Encryption.java