<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Nifi CSFLE inmeplentation with AWS KMS in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-CSFLE-inmeplentation-with-AWS-KMS/m-p/398569#M250245</link>
    <description>&lt;P&gt;Hi Team, I am trying to implement the CSFLE logic using the AWS KMS&amp;nbsp; service. I am using ScriptiedTransformRecord processor with Groovy script. For testing purpose , i have used the sample encryption key which created by openssl and tested the script , it is working fine. However,&amp;nbsp; i would like to use the AWS KMS for the encryption keys. Is the a way to interact with KMS to get the key .&lt;/P&gt;&lt;P&gt;Here is my flow&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 509px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42977i3DD734F0CEF16777/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2024 08:28:34 GMT</pubDate>
    <dc:creator>rajivswe_2k7</dc:creator>
    <dc:date>2024-12-09T08:28:34Z</dc:date>
    <item>
      <title>Nifi CSFLE inmeplentation with AWS KMS</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-CSFLE-inmeplentation-with-AWS-KMS/m-p/398569#M250245</link>
      <description>&lt;P&gt;Hi Team, I am trying to implement the CSFLE logic using the AWS KMS&amp;nbsp; service. I am using ScriptiedTransformRecord processor with Groovy script. For testing purpose , i have used the sample encryption key which created by openssl and tested the script , it is working fine. However,&amp;nbsp; i would like to use the AWS KMS for the encryption keys. Is the a way to interact with KMS to get the key .&lt;/P&gt;&lt;P&gt;Here is my flow&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 509px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42977i3DD734F0CEF16777/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 08:28:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-CSFLE-inmeplentation-with-AWS-KMS/m-p/398569#M250245</guid>
      <dc:creator>rajivswe_2k7</dc:creator>
      <dc:date>2024-12-09T08:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi CSFLE inmeplentation with AWS KMS</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-CSFLE-inmeplentation-with-AWS-KMS/m-p/398570#M250246</link>
      <description>&lt;P&gt;My Groovy script:&lt;/P&gt;&lt;P&gt;import javax.crypto.Cipher&lt;BR /&gt;import javax.crypto.spec.SecretKeySpec&lt;BR /&gt;import java.util.Base64&lt;/P&gt;&lt;P&gt;// Define the AES encryption key&lt;BR /&gt;String encryptionKey = "6ef552ae5333c9abb682e1f5221b1bdc"&lt;/P&gt;&lt;P&gt;// Ensure the key is 16 bytes (128 bits) for AES-128&lt;BR /&gt;if (encryptionKey.length() != 32) {&lt;BR /&gt;throw new IllegalArgumentException("Encryption key must be 16 characters long for AES-128.")&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Convert the key to a SecretKeySpec&lt;BR /&gt;SecretKeySpec aesKey = new SecretKeySpec(encryptionKey.getBytes("UTF-8"), "AES")&lt;/P&gt;&lt;P&gt;// Initialize the Cipher for AES/ECB/PKCS5Padding&lt;BR /&gt;Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding")&lt;BR /&gt;cipher.init(Cipher.ENCRYPT_MODE, aesKey)&lt;/P&gt;&lt;P&gt;// Retrieve the input data to encrypt&lt;BR /&gt;String inputData = record.getValue("name") // Replace "name" with your actual field name&lt;BR /&gt;byte[] encryptedData = cipher.doFinal(inputData.getBytes("UTF-8"))&lt;/P&gt;&lt;P&gt;// Encode the encrypted data to Base64&lt;BR /&gt;String encryptedBase64 = Base64.getEncoder().encodeToString(encryptedData)&lt;/P&gt;&lt;P&gt;// Set the encrypted value back into the record&lt;BR /&gt;record.setValue("name", encryptedBase64)&lt;/P&gt;&lt;P&gt;// Return the updated record&lt;BR /&gt;return record&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 08:29:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-CSFLE-inmeplentation-with-AWS-KMS/m-p/398570#M250246</guid>
      <dc:creator>rajivswe_2k7</dc:creator>
      <dc:date>2024-12-09T08:29:51Z</dc:date>
    </item>
  </channel>
</rss>

