crypto-lib/src/main/java/com/streamsets/pipeline/stage/processor/crypto/FieldEncrypter.java
public Field createResultFieldDecrypt(CryptoResult<byte[], ?> result) {
    Field.Type fieldType = Field.Type.valueOf(
        result.getEncryptionContext().getOrDefault(SDC_FIELD_TYPE, Field.Type.BYTE_ARRAY.name())
    );

    // Field API prohibits STRING to BYTE_ARRAY conversion so this is a special case
    if (fieldType == Field.Type.BYTE_ARRAY) {
      return Field.create(result.getResult());
    }

    // Field API supports STRING to other primitive types.
    return Field.create(
        fieldType,
        new String(result.getResult())
    );
  }
public Field createResultFieldDecrypt(CryptoResult<byte[], ?> result) {
    Field.Type fieldType = Field.Type.valueOf(
        result.getEncryptionContext().getOrDefault(SDC_FIELD_TYPE, Field.Type.BYTE_ARRAY.name())
    );

    // Field API prohibits STRING to BYTE_ARRAY conversion so this is a special case
    if (fieldType == Field.Type.BYTE_ARRAY) {
      return Field.create(result.getResult());
    }

    // Field API supports STRING to other primitive types.
    return Field.create(
        fieldType,
        new String(result.getResult())
    );
  }
Returns a decrypted {@link Field} with its original type preserved when type information
has been preserved in the AAD.

@param result of the decryption operation
@return {@link Field}