Skip to main content

Create PGP RSA Key Pairs in Your Browser Generate PGP-formatted RSA key pairs for email encryption.

PGP Key Generator illustration
🔐

PGP Key Generator

Generate PGP-formatted RSA key pairs for email encryption.

1

Enter details

Name and email.

2

Configure size

Choose 2048 or 4096 bits.

3

Generate

Create PGP keys.

Loading tool...

What Is PGP Key Generator?

A PGP Key Generator is a tool that creates RSA key pairs in PGP format using the Web Crypto API, enabling users to generate a public and private key pair for secure communication. Developers and security professionals use it to establish secure email encryption and digital signing. One specific problem it solves is the need for a convenient way to create PGP-formatted keys without requiring external tools like GPG, allowing users to quickly set up encrypted communication.

The tool is particularly useful for generating pgp keypairs with customizable key sizes, such as 2048 or 4096 bits, and it produces ASCII-armored output. What makes this tool different is its ability to generate keys directly in the browser, without requiring any external software or transmission of sensitive data. It also provides a simple interface for users to input their name and email address, which are then incorporated into the generated pgp key generator output.

It allows users to copy the generated public and private keys with a single click, making it easy to use the keys in other applications. The tool explicitly states that for full OpenPGP compliance, users should use GPG, but for basic PGP-formatted RSA keys, it provides a convenient solution, generating a pgp keypair that can be used for email encryption and signing.

Why Use PGP Key Generator?

  • PGP-armored format
  • Configurable RSA
  • Name/email
  • 100% client-side

Common Use Cases

Email

Encrypted email.

Signing

Digital signatures.

Development

Test PGP.

Education

PGP structure.

Technical Guide

The tool uses the Web Crypto API to generate RSA key pairs with customizable key sizes of 2048 or 4096 bits. Under the hood, it employs the RSA-OAEP algorithm with SHA-256 hashing for secure key generation. The generated keys are then exported in SPKI and PKCS#8 formats, which are subsequently wrapped in PGP armor headers to produce ASCII-armored output. This process involves converting the binary data to base64 encoding using the `ab2b64` function, followed by formatting the encoded string into a PEM structure with `fmtPem`. The resulting public and private keys are formatted as PGP PUBLIC KEY BLOCK and PGP PRIVATE KEY BLOCK, respectively.

The tool's implementation relies on React for building the user interface, where users can input their name and email address. These inputs are used to generate the key pair when the "Generate PGP Key Pair" button is clicked, triggering the `gen` function. This function utilizes the `crypto.subtle.generateKey` method to create a new RSA-OAEP key pair, which is then exported using `crypto.subtle.exportKey`. The exported keys are stored in the component's state as `pubKey` and `privKey`, allowing users to view and copy the generated keys. The copying functionality is handled by the `copyToClipboard` function from the `@/lib/utils` module, which enables users to easily transfer the keys to other applications.

The use of React's `useState` hook allows for efficient state management, while `useCallback` ensures that the `gen` and `copy` functions are only recreated when necessary. The tool also employs various utility functions from `@/lib/utils`, such as `cn` for conditional class names and `copyToClipboard` for copying text to the clipboard. By leveraging these technologies and techniques, the tool provides a convenient and user-friendly interface for generating PGP-formatted RSA key pairs directly in the browser.

Tips & Best Practices

  • 1
    Set key size to 2048 or 4096 bits for optimal security
  • 2
    Enter a valid email address to generate a PGP key pair
  • 3
    Click the 'Copy' button to copy the generated public or private key
  • 4
    Use the Web Crypto API for PGP-formatted RSA keys, but use GPG for full OpenPGP functionality
  • 5
    Check that keys never leave your browser for enhanced security
  • 6
    Generate a new key pair when the name or email fields are filled

Related Tools

Frequently Asked Questions

Q Is the PGP key generator free?
Yes.
Q Does it support full OpenPGP?
Use GPG.
Q Is it secure?
Yes.
Q Which browsers are supported?
All modern.
Q How do I use keys for email?
Import into a PGP client.

About This Tool

PGP Key Generator is a free online tool by FreeToolkit.ai. All processing happens directly in your browser — your data never leaves your device. No registration or installation required.