DER Serialized Private Key Loader
Load a DER-encoded private key so the asymmetric nodes can use it
- keyfile
- password
- loaded_key
DERPrivateKey is the loading dock for the ARG Toolkit's asymmetric-crypto half: it takes a DER-serialized private key (the binary cousin of PEM - no -----BEGIN armor, just raw ASN.1 bytes) and turns it into a live key object that the pack's signing and encryption nodes can consume. If you've got an RSA, EC, or Ed25519 key in DER form and want to use it inside a ComfyUI graph, this is the node that makes that possible. It's the "read this key file into memory" step that everything downstream depends on.
The realistic audience is narrow: most people don't hand their private keys around in DER format, and the pack's own PEMPrivateKey node is the more common entry point for the same job. DER shows up when you're working with raw cryptographic tooling, smartcards, or legacy PKCS#1/PKCS#8 dumps - or when an ARG hands you a binary key file and dares you. That's the moment this node becomes the only way in. Note the output isn't a string or bytes - it's a KEYOBJ, the pack's opaque "this is a real key object" datatype, which only wires into the pack's own asymmetric nodes (XDH, ECDSA, encryption) and not into generic string slots.
How it works
You feed it the raw DER bytes via the keyfile input (a BYTESLIKE slot, so run the file's contents through ByteslikeEncode if you're pasting text). It calls cryptography's serialization.load_der_private_key(), which parses the ASN.1 structure, validates it, and returns a usable private-key object. The optional password input is for keys that are DER-encrypted (PKCS#8 encrypted keys); pass the password as bytes and leave it unwired for unencrypted keys. The output, loaded_key, is the KEYOBJ you wire into the pack's asymmetric operations.
The inputs that matter
keyfile- the DER-encoded private key, as bytes. This is the whole job.password(optional) - bytes for an encrypted key; leave empty if the key isn't password-protected.
Output: loaded_key, a KEYOBJ for downstream asymmetric nodes.
Installing it
Part of the ComfyUI ARG Toolkit pack. Install via ComfyUI Manager (search "ComfyUI ARG Toolkit") or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI. Runs on the pack's cryptography dependency (with secretpy, stegano, invisible-watermark, reedsolo, and transitive torch/opencv-python). No models, no API keys.
Gotchas
Three things will bite. First, format matters: DER is binary, not the base64-with-armor that PEM uses - feed a PEM string into this node and the parser will reject it (use PEMPrivateKey for that). Second, the password (if any) must be bytes, and an encrypted key without the right password throws rather than degrades. Third, don't expect to read the output: KEYOBJ is intentionally opaque and only connects to the pack's own asymmetric nodes, so if a wire won't reach a node you expected it to, that's the datatype enforcing its rules. As with the rest of this pack, tests are hobby-grade - load a known-good key to confirm the node behaves before building a workflow around it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| keyfile | BYTESLIKE | — | |
| passwordopt | BYTESLIKE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| loaded_key | KEYOBJ | — |