Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Mule CRC32 Processor

When to Use CRC32

Mule can apply a cyclic redundancy check (CRC) to messages to ensure integrity. The CRC32 processor acts as an enricher to generate a checksum to a message when it enters a system, then act as a filter to verify the checksum when the message leaves the system. If the entry and exit values do not match, CRC terminates the message’s processing. 

The CRC32 processor allows the user to verify that a message remains intact between a sender and a receiver. Because it does not itself provide encryption or append a signature to the message, you can use it in conjunction with other security features to provide an additional level of confidence in the authenticity of a message.

Generating a Checksum

This topic introduces the idea of Global Elements; if you are unfamiliar with this functionality, access Understand Global Mule Elements to learn more before proceeding.

To use the CRC32 processor to generate a checksum on a message, you must, at minimum, configure two elements in your Mule application:

  • a global CRC32 element

  • a CRC32 processor

Completing these steps ensures that Mule calculates a checksum based on your payload and enriches the properties of your Mule message with that checksum. 

Creating a Global Element

  1. Create and configure the global element through the Global Element tab at the bottom of the canvas, or directly within the CRC32 building block’s Properties pane by clicking the (plus) icon to the right of the Connector Ref field. 

  2. In the Global Element Properties pane, enter a meaningful Name for the global element.

  3. In the Target Expression field, accept the default variable name. See image below for example. 

GlobalCRC32Calculation5

Or, configure the global element in the XML editor, as shown below:


          
       
1
<crc32:config name="Global_CRC32_Calculation" targetExpression="#[variable:crc32]/>

Configuring a CRC32 Message Processor 

  1. Insert a CRC32 processor in your Mule flow.

  2. In the Pattern Properties pane, enter a Display Name.

  3. Reference the global CRC32 element that you just created by clicking the (plus) icon next to the Config Reference field.

  4. Set the Operation field to Calculate.

CRC32Calculation2

By default, Mule calculates based on the entire payload. Use the Input Reference field to specify a different target for the calculation, if necessary.

Or, configure the CRC32 building block in the XML editor, as shown below:


          
       
1
<crc32:calculate config-ref="Global_CRC32_Calculation" doc:name="CRC Calculation"/>

Verifying a Checksum

To use the CRC32 processor to verify a checksum on a message, you must, at minimum, configure two elements in your Mule application:

  • a CRC32 message processor

  • a CRC32 global element

Completing these steps ensure that Mule verifies the checksum in the properties of your message by comparing it against the checksum you calculated in the CRC32 calculation, Generating a Checksum

Configuring a CRC32 Message Processor

  1. First, insert a CRC32 processor into your Mule flow, positioned at the point where you would like to verify the checksum.

  2. Double-click the message processor to open the Pattern Properties pane, then enter a Display Name.

  3. Set the Operation field to CRC Filter.

  4. Enter the Expected Checksum, matching the contents of the Target Expression field in the CRC32 global element in your configuration of the CRC32 calculation.

    CRC32Filter3

Or, configure the CRC32 building block in the XML editor, as shown below:


          
       
1
<crc32:filter config-ref="CRC32" expectedChecksum="#[variable:crc32]" doc:name="CRC32 Filter"/>

Creating a CRC32 global element

  1. Click the (plus) icon next to the Config Reference field.

  2. Delete the default text in the Target Expression field, leaving this field blank, then click OK

This "blank" global element satisfies Mule Studio’s configuration requirements and needs no further configuration.