天天看點

Apache NIFI CryptographicHashAttribute

編輯人(全網同名):酷酷的誠 郵箱:[email protected]

描述

該處理器使用給定算法計算每個指定屬性的哈希值,并将其寫入到輸出屬性。請參考https://csrc.nist.gov/Projects/Hash-Functions/NIST-Policy-on-Hash-Functions來決定使用哪種算法。

屬性配置

在下面的清單中,必需屬性的名稱以粗體顯示。任何其他屬性(不是粗體)都被認為是可選的,并且指出屬性預設值(如果有預設值),以及屬性是否支援表達式語言。

屬性名稱 預設值 可選值 描述
Character Set UTF-8
  • US-ASCII
  • ISO-8859-1
  • UTF-8
  • UTF-16BE
  • UTF-16LE
  • UTF-16
用于解碼被哈希的屬性的字元集——這适用于傳入的資料,而不是輸出資料。
Fail when no attributes present true
  • true
  • false

設定為true時,如果沒有找到配置的将要被哈希的屬性,則路由到failure(配置的所有屬性在流檔案中都沒有被找到)。如果設定為false,沒有找到配置的将要被哈希的屬性時流檔案将路由到sucess(流檔案中不存在任何一個該處理器配置的屬性)。

(注:以上說明皆在Allow missing attributes 的前提下)

Hash Algorithm SHA-256
  • MD2
  • MD5
  • SHA-1
  • SHA-224
  • SHA-256
  • SHA-384
  • SHA-512
  • SHA-512/224
  • SHA-512/256
  • SHA3-224
  • SHA3-256
  • SHA3-384
  • SHA3-512
  • BLAKE2-160
  • BLAKE2-256
  • BLAKE2-384
  • BLAKE2-512
要使用的加密雜湊演算法。
Missing attribute policy ALLOW
  • Allow missing attributes
  • Fail if missing attributes
選擇AlLLOW,則當流檔案中不含某些配置中指定的需要被哈希的屬性時,則路由到success。否則,路由到failure。

動态屬性:

該處理器允許使用者指定屬性的名稱和值。

屬性名稱 屬性值 描述
用于屬性檢查的flowfile屬性鍵 Attribute Name

定義檔案流中需要被哈希的屬性.

支援表達式語言:false

連接配接關系

名稱 描述
failure 失敗
sucess 加密成功

讀取屬性

沒有指定。

寫屬性

名稱 描述
處理器配置需要被哈希的屬性名稱 處理器配置需要被哈希的屬性。

狀态管理

此元件不存儲狀态。

限制

此元件不受限制。

輸入要求

此元件需要傳入關系。

系統資源方面的考慮

沒有指定。

應用場景

将檔案流中的特定屬性進行哈希,用于加密等等。

示例說明

1:Allow missing attributes

Fail when no attributes present 設定為true,來源流檔案中隻包含一個secureKey屬性,而該處理器配置test1屬性進行MD5加密

Apache NIFI CryptographicHashAttribute

當流檔案到達該處理器,處理器比對不到任何屬性(示例中為比對不到test1屬性),雖然選擇Allow missing attributes,但還是路由到failure。

Apache NIFI CryptographicHashAttribute

2:案例1中将Fail when no attributes present 設定為false,其他不變。

Apache NIFI CryptographicHashAttribute

同樣的這次也沒有比對到任何屬性,但路由到success;

Apache NIFI CryptographicHashAttribute

3:Allow missing attributes

Fail when no attributes present 設定為true,來源流檔案中隻包含了一個secureKey屬性,而該處理器配置secureKey屬性進行MD5加密

Apache NIFI CryptographicHashAttribute

來源流檔案屬性:

Apache NIFI CryptographicHashAttribute

輸出流檔案屬性:

Apache NIFI CryptographicHashAttribute
Apache NIFI CryptographicHashAttribute

公衆号

關注公衆号 得到第一手文章/文檔更新推送。

Apache NIFI CryptographicHashAttribute