NodeCrypto Help

Block Unpadding

Category: Utility ยท Node Type ID: padding-block-unpad

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

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Padding Standard
paddingType
select
Default: 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
select
Default: 16
Always visible Block size in bytes (8, 16, or 32) that the input buffer must be aligned to.
  • 8: 8 Bytes (64 bits - DES/3DES)
  • 16: 16 Bytes (128 bits - AES/SEED/ARIA/Camellia/SM4)
  • 32: 32 Bytes (256 bits)
Unify Errors
errorUnify
boolean
Default: false
Supports Variable Reference ($var: bool)
Always visible Replaces built-in errors with a custom error code/message when enabled.
Unified Error Code
errorUnifyCode
text
Default: "" (empty)
Supports Variable Reference ($var: string)
When errorUnify is true Custom error code when Unify Errors is enabled.
Unified Error Message
errorUnifyMessage
text
Default: "" (empty)
Supports Variable Reference ($var: string)
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 NamePort IDData TypeRequiredVisibility ConditionDescription
Padded Data data Bytes Required Always visible Unpadded original byte array (Uint8Array).

Output Ports

Port Nature: Fixed Output Ports (1 total).

Port NamePort IDData TypeVisibility ConditionDescription
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 CodeDefault Engine MessageTrigger 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.

  1. Connect the output of a raw decrypt node (Padding = None) to Padded Data on Block Unpadder.
  2. Set Padding Standard to PKCS#7 and Block Size to 16 to recover the original unpadded bytes on Unpadded Data.