Block Unpadding
Removes cryptographic block padding (PKCS#7, ANSI X9.23, ISO/IEC 9797-1 Method 2/3, None)
Overview
Validates and strips cryptographic block padding from a block-aligned byte array according to the selected Padding Standard (PKCS7, ISO7816, ISO97971M3, ANSIX923, or None) and Block Size (Bytes) (8, 16, or 32).
If the input byte length is not a positive multiple of the block size or if the trailing bytes violate the structure of the selected padding rule, execution halts with an error. Note that Zero and NIST80038B padding are not reversible without external length knowledge and are therefore excluded from automatic unpadding.
When to Use
- Stripping and verifying block padding after decrypting with a cipher node configured with
Padding = None. - Testing padding-oracle / malformed-padding error handling in custom workflows.
Parameter Configuration
| Parameter (ID) | Type & Default | Visibility Condition | Description & Options |
|---|---|---|---|
Padding StandardpaddingType |
selectDefault: None |
Always visible | Selects the reversible padding standard to verify and remove (PKCS7, ISO7816, ISO97971M3, ANSIX923, or None). See Padding Schemes.
|
Block Size (Bytes)blockSize |
selectDefault: 16 |
Always visible | Block size in bytes (8, 16, or 32) that the input buffer must be aligned to.
|
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 |
|---|---|---|---|---|---|
Padded Data |
data |
Bytes |
Required | Always visible | Unpadded original byte array (Uint8Array). |
Output Ports
Port Nature: Fixed Output Ports (1 total).
| Port Name | Port ID | Data Type | Visibility Condition | Description |
|---|---|---|---|---|
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 |
|---|---|---|
INVALID_PADDING |
Invalid padding | Raised when the decrypted or input block's trailing bytes violate the structure of the selected padding standard. |
Examples
Unpadding Decrypted Block Data
Strip PKCS#7 padding from a 16-byte decrypted block.
- Connect the output of a raw decrypt node (
Padding = None) toPadded Dataon Block Unpadder. - Set Padding Standard to
PKCS#7and Block Size to16to recover the original unpadded bytes onUnpadded Data.