Configure and click Process to see results
RSA signatures use the same key pair as RSA encryption: a public key for verification and a private key for signing. The key pair is generated by selecting two large prime numbers and computing mathematical relationships between them.
How Signing Works:
How Verification Works:
Sign contracts, PDFs, and legal documents to prove authenticity and prevent tampering. Digital signatures provide legal validity in many jurisdictions.
Sign software binaries, executables, and scripts to verify publisher identity and ensure code hasn't been modified. Essential for app stores and enterprise software.
Sign emails to prove sender identity and message integrity. S/MIME and PGP use RSA signatures to combat phishing and email spoofing.
Sign API requests to prove they came from an authorized source. Used in OAuth, JWT tokens, and webhook verification.
Your keys, messages, and signatures are processed in-session only. We don't log, store, or transmit your cryptographic data to third parties.
Built on standard Java Cryptography Architecture (JCA) implementing PKCS#1 specifications. No proprietary or unverified algorithms.
Designed for learning, testing, and development. Perfect for understanding RSA signature concepts, algorithms, and verification processes.
Part of 8gwifi.org's suite of cryptography tools, serving developers and security professionals worldwide since 2010.
About the Developer: This tool is developed and maintained by Anish Nath, a Security Engineer with extensive expertise in cryptography, PKI, digital signatures, and secure application development. Anish has created multiple open-source security tools and regularly publishes technical content on cryptographic implementations.
Connect: Twitter
The Rivest-Shamir-Adleman (RSA) algorithm is one of the most widely used public-key cryptography methods. RSA digital signatures provide authentication, integrity, and non-repudiation by using asymmetric key pairs.
h = Hash(message)m = Pad(h)s = md mod nsignature = Base64(s)s = Base64Decode(signature)m' = se mod nh' = Unpad(m')h' == Hash(message)Where: d = private exponent, e = public exponent (usually 65537), n = modulus
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa, padding
# Generate RSA key pair
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
public_key = private_key.public_key()
# Sign message
message = b"Hello, World!"
signature = private_key.sign(
message,
padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.MAX_LENGTH),
hashes.SHA256()
)
print(f"Signature (hex): {signature.hex()[:64]}...")
# Verify signature
try:
public_key.verify(
signature,
message,
padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.MAX_LENGTH),
hashes.SHA256()
)
print("✓ Signature is valid")
except Exception:
print("✗ Signature is invalid")
pip install cryptography
import java.security.*;
import java.util.Base64;
public class RSASignatureExample {
public static void main(String[] args) throws Exception {
// Generate RSA key pair
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(2048);
KeyPair keyPair = keyGen.generateKeyPair();
// Sign message
String message = "Hello, World!";
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(keyPair.getPrivate());
sign.update(message.getBytes("UTF-8"));
byte[] signature = sign.sign();
System.out.println("Signature: " + Base64.getEncoder().encodeToString(signature));
// Verify signature
Signature verify = Signature.getInstance("SHA256withRSA");
verify.initVerify(keyPair.getPublic());
verify.update(message.getBytes("UTF-8"));
boolean isValid = verify.verify(signature);
System.out.println("Valid: " + isValid);
}
}
const crypto = require('crypto');
// Generate RSA key pair
const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 2048,
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
});
// Sign message
const message = 'Hello, World!';
const sign = crypto.createSign('SHA256');
sign.update(message);
sign.end();
const signature = sign.sign(privateKey, 'base64');
console.log('Signature:', signature.substring(0, 64) + '...');
// Verify signature
const verify = crypto.createVerify('SHA256');
verify.update(message);
verify.end();
const isValid = verify.verify(publicKey, signature, 'base64');
console.log('Valid:', isValid);
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"fmt"
)
func main() {
// Generate RSA key pair
privateKey, _ := rsa.GenerateKey(rand.Reader, 2048)
publicKey := &privateKey.PublicKey
// Sign message
message := []byte("Hello, World!")
hashed := sha256.Sum256(message)
signature, _ := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed[:])
fmt.Printf("Signature: %s...\n", base64.StdEncoding.EncodeToString(signature)[:64])
// Verify signature
err := rsa.VerifyPKCS1v15(publicKey, crypto.SHA256, hashed[:], signature)
if err != nil {
fmt.Println("✗ Signature is invalid")
} else {
fmt.Println("✓ Signature is valid")
}
}
go run main.go - uses standard library packages
# Generate RSA private key
openssl genrsa -out private_key.pem 2048
# Extract public key
openssl rsa -in private_key.pem -pubout -out public_key.pem
# Sign a message (file)
echo "Hello, World!" > message.txt
openssl dgst -sha256 -sign private_key.pem -out signature.bin message.txt
# Convert signature to Base64
base64 signature.bin > signature.b64
# Verify signature
openssl dgst -sha256 -verify public_key.pem -signature signature.bin message.txt
# Output: Verified OK
Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.