Block Padding
Applies cryptographic block padding (PKCS#7, ANSI X9.23, ISO/IEC 9797-1 Method 1/2/3, NIST SP 800-38B, None)
Overview
Applies a cryptographic block padding scheme to an arbitrary-length byte array so its output length is an exact multiple of the selected Block Size (Bytes) (8, 16, or 32 bytes).
Supports all 7 padding options documented in Padding Schemes: PKCS#7 (RFC 5652), ISO/IEC 9797-1 Method 2 (ISO/IEC 7816-4), ISO/IEC 9797-1 Method 3, NIST SP 800-38B (CMAC conditional), ANSI X9.23, ISO/IEC 9797-1 Method 1 (Zero Padding), and None.
When to Use
- Explicitly padding data before feeding it into a cipher node configured with
Padding = Noneso you can inspect the exact padded block bytes on the canvas. - Using specialized padding rules not built directly into a cipher node's dropdown (such as
NIST80038Bconditional padding or 32-byte block padding).
Parameter Configuration
| Parameter (ID) | Type & Default | Visibility Condition | Description & Options |
|---|---|---|---|
Padding StandardpaddingType |
selectDefault: None |
Always visible | Selects the block padding standard to apply. See Padding Schemes for byte-level diagrams and examples of each rule.
|
Block Size (Bytes)blockSize |
selectDefault: 16 |
Always visible | Target block size in bytes: 8 (64-bit, DES/3DES), 16 (128-bit, AES/SEED/ARIA/Camellia/SM4), or 32 (256-bit).
|
Unify ErrorserrorUnify |
booleanDefault: false |
Always visible | Replaces built-in errors with a custom error code/message when enabled. |
Unified Error CodeerrorUnifyCode |
textDefault: "" (empty) |
When errorUnify is true |
Custom error code when Unify Errors is enabled. |
Unified Error MessageerrorUnifyMessage |
textDefault: "" (empty) |
When errorUnify is true |
Custom error message when Unify Errors is enabled. |
Port I/O Specification
See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.
Input Ports
Port Nature: Fixed Input Ports (1 total).
| Port Name | Port ID | Data Type | Required | Visibility Condition | Description |
|---|---|---|---|---|---|
Data |
data |
Bytes |
Required | Always visible | Unpadded input byte array (Uint8Array). |
Output Ports
Port Nature: Fixed Output Ports (1 total).
| Port Name | Port ID | Data Type | Visibility Condition | Description |
|---|---|---|---|---|
Padded Data |
result |
Bytes |
Always visible |
Error Cases
When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute. Enabling Unify Errors (errorUnify) replaces all error codes below with your configured unified error code and message.
| Error Code | Default Engine Message | Trigger Condition |
|---|---|---|
PLAINTEXT_NOT_BLOCK_ALIGNED |
In NoPad mode the plaintext length must be a multiple of the block size | Raised only when Padding Standard = None and the input Data byte length is not already a multiple of Block Size. |
Examples
Inspecting PKCS#7 Padding Before AES-ECB Encryption
Pad a 10-byte message to 16 bytes and inspect the 0x06 padding bytes.
- Connect a 10-byte input to Block Padder with
Padding Standard = PKCS#7andBlock Size = 16. - Connect
Padded Databoth to an Output Inspector (showing 6 trailing06bytes) and to AES Encrypt (withPadding = None).