Parse and decode RSA, DSA, or ECDSA public keys. Extract modulus, exponent, curve type, and key size parameters.
A Public Key Decoder is a specialized technical utility designed to parse the encoded structure of cryptographic public keys. Most public keys are not stored as raw numbers but are wrapped in a standardized format known as ASN.1 (Abstract Syntax Notation One), often encoded using DER (Distinguished Encoding Rules) or wrapped in PEM (Privacy-Enhanced Mail) base64 containers. This tool allows developers to peel back these layers to inspect the actual mathematical components of the key.
When a public key is uploaded, the decoder first identifies the encoding format. If the input starts with -----BEGIN PUBLIC KEY-----, the tool strips the headers and footers and converts the base64 string into a binary DER blob. The parser then traverses the ASN.1 tree, identifying specific Object Identifiers (OIDs) that tell the system whether the key is RSA, ECDSA, or Ed25519.
To decode a key, simply paste your PEM-encoded string into the input field. The tool will automatically detect the format and render the decoded structure. For those working with raw binary files, you can upload the .der or .crt file directly.
While the web tool is ideal for quick audits, developers often need to perform this decoding programmatically. Below is an example of how to decode a public key using Python and the cryptography library:
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
# Load the PEM public key
with open("public_key.pem", "rb") as key_file:
public_key = serialization.load_pem_public_key(key_file.read())
# Extract the modulus and exponent
print(f"Modulus: {public_key.public_numbers().n}")
print(f"Exponent: {public_key.public_numbers().e}")For JavaScript/Node.js environments, developers typically use the node:crypto module or libraries like asn1.js to traverse the DER structure manually.
Security is paramount when handling cryptographic material. This tool adheres to the following strict privacy standards:
This tool is specifically engineered for Security Researchers performing audits, DevOps Engineers debugging SSL/TLS certificate chains, and Backend Developers implementing custom encryption schemes who need to verify the mathematical properties of their generated keys.
DER (Distinguished Encoding Rules) is a binary format that represents the ASN.1 structure of a key as a compact byte stream. PEM (Privacy-Enhanced Mail) is essentially a DER blob that has been Base64 encoded and wrapped in text headers like 'BEGIN PUBLIC KEY'. Most modern tools use PEM for ease of transport via text files, while hardware modules often require the raw DER binary.
Yes, it is fundamentally safe because public keys are designed to be shared publicly; they do not contain the private secret used for decryption or signing. Furthermore, this specific tool operates entirely on the client-side using JavaScript. Because no data is sent to a backend server, there is no risk of the key being intercepted or logged by a third party.
Object Identifiers are unique numeric strings (e.g., 1.2.840.113549.1.1.1) that act as global identifiers for specific algorithms or data types. In a public key, the OID tells the decoder whether to interpret the following bytes as an RSA key, a DSA key, or an Elliptic Curve key. Without the correct OID, the decoder would not know how to parse the subsequent mathematical components.
RSA security is based on the difficulty of factoring large integers. The modulus (n) is the product of two large secret primes, and the public exponent (e) is used for the encryption process. Together, (n, e) constitute the public key. The decoder extracts these two specific values so you can verify the key strength and the standard nature of the exponent.
While the underlying ASN.1 parsing logic can technically read private key structures, this tool is specifically optimized for public key decoding to prevent the accidental exposure of sensitive data. Private keys contain highly sensitive components (like the private exponent d) that should never be pasted into any web-based tool, regardless of whether it claims to be client-side.
An 'Invalid Format' error usually occurs if the input is not a valid PEM or DER structure. Ensure that you have included the full header and footer (including the dashes) if using PEM. If you are using a raw hex string, ensure there are no spaces or non-hexadecimal characters. If the key is in an unconventional format like OpenSSH, you may need to convert it to PKCS#8 using OpenSSL first.