Nodes/ComfyUI ARG Toolkit/Elliptic Curve Public Key Bytes
ComfyUI Node

Elliptic Curve Public Key Bytes

Turn a private key into a shareable public key — bytes and object, both

By AzelusLightvale·Created 12 months ago·Updated 5 days ago· 1
Elliptic Curve Public Key Bytes
  • serialized_key
  • public_bytes
  • public_key
curve_name
key_sourcetrue
formattingPKCS8
encodingPEM

Public keys are the shareable half of an ECDSA signing setup: the signer keeps the private key, everyone else gets the public key, and ECVerify uses it to confirm signatures. ECPublicKey ("Elliptic Curve Public Key Bytes") is the node that produces that half, and it does it in every format a puzzle might expect - standard SubjectPublicKeyInfo, OpenSSH's ssh-ed25519-style line, bare PKCS1, or raw compressed/uncompressed points.

How it works

It derives the public key from an elliptic curve private key. The curve and the "where does the private key come from" question are the two things you set, and they're the parts people get wrong.

key_source is a toggle:

  • Fresh Key (the default) - the node generates a brand-new private key internally, then derives the public key from it. Handy for standalone "make me a keypair" purposes, but the private half evaporates unless you captured it elsewhere, so you get a public key with no way to sign. That's usually a mistake for a real signing loop.
  • From Loaded Key - the node takes the serialized_key (KEYOBJ) you wire in from ECPrivateKey's private_key output and derives the public key from that. This is the one you actually want for signing: same keypair, public half in hand, private half still available for ECSign.

The curve must match whatever the private key was generated on. curve_name picks it - SECP256K1, SECP256R1, the Brainpool set, and friends. If the curves disagree, nothing downstream verifies.

Outputs and serialization

Two outputs, and they're different flavors of the same thing:

  • public_bytes (BYTESLIKE) - the serialized key, formatted per your formatting/encoding choices. SubjectPublicKeyInfo + PEM is the boring, compatible default. CompressedPoint/UncompressedPoint with X962 encoding gives you the raw math (the bare x coordinate, or x,y) - compact, and the kind of thing an ARG would actually hide in a text file.
  • public_key (KEYOBJ) - the parsed object for wiring straight into ECVerify's public_key input.

One wrinkle: the schema shows a default of PKCS8 on the formatting dropdown, but PKCS8 isn't in the actual choice list - pick from the five that are (SubjectPublicKeyInfo, OpenSSH, PKCS1, CompressedPoint, UncompressedPoint). A minor UI quirk in a pack that's honest about being an amateur project.

Installing it

Same as every node in this pack - it's part of the ComfyUI ARG Toolkit:

cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit

Restart ComfyUI, or find "ComfyUI ARG Toolkit" in ComfyUI Manager and let it sort the dependencies (cryptography does the heavy lifting).

Where people get burned

  • Fresh Key + forgetting the private half. You end up with a public key you can't sign with. If the goal is a keypair, always source the private key from ECPrivateKey and toggle key_source to From Loaded Key.
  • Point formats look like garbage. UncompressedPoint/X962 output is raw bytes, not a -----BEGIN PUBLIC KEY----- block. If you're pasting this somewhere, you need the PEM/SubjectPublicKeyInfo combo instead.
  • Curve mismatch with the verifier. ECVerify doesn't care about curves (it just gets a key object), but the other side of the conversation does. Both sides have to agree.

Once you have public_bytes, the fun part begins: hide it in a watermark, scatter it through a text cipher, or just hand it to a friend so they can verify your signed messages.

CategoryARG Toolkit/Cryptography/Modern/Asymmetric

Inputs (5)

NameTypeDefaultDescription
curve_nameCOMBO9 options: SECP192R1, SECP224R1, SECP256K1, SECP256R1, SECP384R1, SECP521R1, +3
key_sourceBOOLEANtrueThe source of the private key to be used to sign the message
formattingCOMBOPKCS85 options: SubjectPublicKeyInfo, OpenSSH, PKCS1, CompressedPoint, UncompressedPoint
encodingCOMBOPEM4 options: PEM, DER, OpenSSH, X962
serialized_keyoptKEYOBJ

Outputs (2)

NameTypeDescription
public_bytesBYTESLIKE
public_keyKEYOBJ