NodeCrypto Help

Block Padding

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

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

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Padding Standard
paddingType
select
Default: 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
select
Default: 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).
  • 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
Data data Bytes Required Always visible Unpadded input byte array (Uint8Array).

Output Ports

Port Nature: Fixed Output Ports (1 total).

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

  1. Connect a 10-byte input to Block Padder with Padding Standard = PKCS#7 and Block Size = 16.
  2. Connect Padded Data both to an Output Inspector (showing 6 trailing 06 bytes) and to AES Encrypt (with Padding = None).