Get started with jsrsasign CDN
MIT licensed
JsRSASign: library for RSA/DSA signing, HMAC, verification, and random number generation.
Tags:- RSA
- ECDSA
- DSA
- RSAPSS
- PKCS#1
- PKCS#5
- PKCS#8
- private key
- public key
- CSR
- PKCS#10
- hash function
- HMac
- ASN.1
- certificate
- X.509
- RFC 3161
- Digital Timestamp
- Timestamp
- Time Stamp Token
- CMS
- Cryptgraphic Message Syntax
- PKCS#7
- Signature
- Digital Signature
- signing
- Message Digest
- JSON Web Token
- JWT
- JSON Web Signature
- JWS
- JSON Web Key
- JWK
- JOSE
- JWA
Stable version
Copied!
How to start using jsrsasign CDN
// Include the jsrsasign library
const KJUR = document.createElement('script');
KJUR.src = 'https://cdn.cdnhub.io/jsrsasign/11.1.0/jsrsasign-all-min.js';
document.head.appendChild(KJUR);
// Wait for the library to be loaded
window.onload = () => {
const jsrsasign = window.kjur;
// Generate an RSA key pair
const keySize = 2048;
const rsaKeyPair = jsrsasign.KJUR.crypto.KeyPairGenerator.RSA.generateKeyPair(keySize);
// Extract the public and private keys
const publicKey = rsaKeyPair.publicKeyInfo.module.exports();
const privateKey = rsaKeyPair.privateKeyInfo.module.exports();
// Sign a message using the private key
const message = 'Hello, world!';
const signer = new jsrsasign.KJUR.crypto.Signer('SHA256withRSA');
signer.init(privateKey);
signer.updateString(message);
signer.final();
// Get the signed message and the signature
const signature = signer.getSignature();
const signedMessage = signer.toASN1Structure().toDER().getBytes();
// Print the results
console.log('Message:', message);
console.log('Public Key:', publicKey.toPEM());
console.log('Private Key:', privateKey.toPEM());
console.log('Signed Message:', signedMessage.toString('base64'));
console.log('Signature:', signature.toDER().getBytes().toString('base64'));
};
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
All versions
10.0.0
10.0.1
10.0.2
10.0.3
10.0.4
10.0.5
10.1.0
10.1.1
10.1.10
10.1.11
10.1.12
10.1.13
10.1.2
10.1.3
10.1.4
10.1.5
10.1.6
10.1.7
10.1.8
10.1.9
10.2.0
10.3.0
10.3.1
10.3.2
10.4.0
10.4.1
10.5.0
10.5.1
10.5.10
10.5.11
10.5.12
10.5.13
10.5.14
10.5.15
10.5.16
10.5.17
10.5.18
10.5.19
10.5.2
10.5.20
10.5.21
10.5.22
10.5.23
10.5.24
10.5.25
10.5.26
10.5.27
10.5.3
10.5.4
10.5.5
10.5.6
10.5.7
10.5.8
10.5.9
10.6.0
10.6.1
10.7.0
10.8.0
10.8.1
10.8.2
10.8.3
10.8.4
10.8.5
10.8.6
10.9.0
11.0.0
*** 11.1.0
4.1.1
4.1.2
4.1.3
4.1.4
4.1.6
4.2.0
4.2.1
4.2.2
4.2.3
4.5.0
4.6.0
4.7.0
4.7.1
4.7.2
4.8.0
4.8.1
4.8.2
4.8.3
4.8.5
4.8.6
4.9.0
4.9.1
4.9.2
5.0.0
5.0.1
5.0.10
5.0.11
5.0.12
5.0.13
5.0.14
5.0.15
5.0.2
5.0.4
5.0.5
5.0.6
5.0.7
5.0.8
5.0.9
5.1.0
6.0.0
6.0.1
6.1.0
6.1.1
6.1.2
6.1.4
6.2.0
6.2.1
6.2.2
6.2.3
7.0.0
7.1.0
7.1.1
7.1.2
7.1.3
7.1.4
7.2.0
7.2.1
7.2.2
8.0.0
8.0.1
8.0.10
8.0.11
8.0.12
8.0.13
8.0.14
8.0.15
8.0.16
8.0.17
8.0.18
8.0.19
8.0.2
8.0.20
8.0.21
8.0.22
8.0.23
8.0.24
8.0.3
8.0.4
8.0.5
8.0.6
8.0.7
8.0.8
8.0.9
9.0.0
9.0.1
9.0.2
9.0.3
9.1.0
9.1.1
9.1.2
9.1.4
9.1.5
9.1.6
9.1.7
9.1.8
9.1.9