RSA Public Numbers into Key
All an RSA public key ever was, is two numbers
- public_key
- public_numbers
An RSA public key is not really a file format. It's two integers: a modulus n and an exponent e. Everything else - PEM armour, DER bytes, SubjectPublicKeyInfo headers - is packaging. RSA Public Numbers into Key takes the two raw numbers and hands back the packaged thing ComfyUI's crypto nodes actually want.
That makes it the node you reach for when a puzzle hands you n and e as decimal digits and you have no key file, no PEM, nothing to load.
Where it sits
This is part of AzelusLightvale's ComfyUI ARG Toolkit (ARG Toolkit/Cryptography/Modern/Asymmetric), the pack that puts ciphers, steganography and modern crypto inside ComfyUI instead of in a CyberChef tab. Within the RSA family it's the low-level entry point: the other public-key path is RSA Public Key Bytes, which either generates a fresh keypair or serializes an existing one. This one doesn't generate anything. It just assembles.
The mechanism
Five lines of source, and worth knowing them:
pub_num = rsa.RSAPublicNumbers(n=public_modulus, e=public_exponent)
return (pub_num.public_key(), pub_num)
RSAPublicNumbers is pyca's plain container, and .public_key() wraps it into a real RSAPublicKey object - the same object type that RSA Verify and RSA Encrypt Data expect on their public_key socket. So this node is a type adaptor: n/e in, KEYOBJ out, plus the container itself so you can chain it into other numbers-based nodes.
Inputs and outputs
public_modulus is n, the product of the two secret primes. public_exponent is e, which is 65537 roughly always - the default is right and you should leave it unless the puzzle says otherwise. One warning: the modulus widget ships with a default of 3, which is a placeholder value, not a key. Forget to change it and you build a public key with a 2-bit modulus that will fail on every real encryption.
Outputs are public_key (KEYOBJ, the usable key) and public_numbers (NUMOBJ, the container - which is what RSA Public Numbers Values reads, and what RSA Private Numbers into Key needs to pair a private key back up).
Here's the honest problem with this node, and it's the one thing that will bite you: both integers are widgets, and both are capped at 4,294,967,296. That's 2³². A 2048-bit modulus is a 617-digit number. You cannot type a real one in, at all, on any ComfyUI build - the widget range won't allow it, and even if it did, the number would pass through JavaScript's double-precision floats on its way in and come back subtly wrong.
So this node is for the toy end of the spectrum: small educational keys, CTF-style 32-bit puzzles, or numbers that arrive over a wire from another INT output rather than from your keyboard. For real 2048-bit material you want RSA Public Key Bytes, which serializes a key from an actual key object and never asks you to type digits.
Install
Manager → search ComfyUI ARG Toolkit → install → restart → refresh. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
pip install -r requirements.txt
No models involved; the dependency that matters is cryptography. Check requirements.txt before you run it though - it's a locked uv export that includes torch and torchaudio, so a manual pip install -r can replace a working CUDA torch with a different pinned build. If you install by hand, verify torch afterwards.
Common issues
The key builds but encryption fails immediately. You left public_modulus at its default of 3. It's not a fallback, it's just a starting value.
"Could not deserialize key data" or a value error on build. n and e don't form a valid public key - n must be odd and larger than 1, and pyca validates. Check the digits, especially if you hand-copied them.
The wire won't connect downstream. NUMOBJ is a pack-local type. Only nodes from this pack have sockets that accept it; there's no core ComfyUI node that reads RSA number containers.
You're typing a 617-digit modulus and it won't accept it. Expected. Use the key-serialization nodes.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| public_modulus | INT | 31–4294967296 | The public modulus (n). |
| public_exponent | INT | 655371–4294967296 | The public exponent (e). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| public_key | KEYOBJ | — |
| public_numbers | NUMOBJ | — |