Skip to content

cberthou/aes-gcm-rsa-oaep

Repository files navigation

AES-GCM + RSA OAEP

POC of AES-GCM + RSA-OAEP encryption/decryption using window.crypto api.

Tests uses @peculiar/webcrypto for polyfilling browser crypto api.

This can be used to replace kubeseal encryption in JavaScript environments.

Using x509 certificates

To be able to use x509 certificates, you need to first extract the public key with openssl :

openssl x509 -in ./cert.pem -pubkey -noout > certificate_publickey.pem

Extracting the public key form the certificate is a pain to do in JS.

You can also use node-forge to do it :

import { pki } from "node-forge";

const cert = pki.certificateFromPem(
  `-----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----`
);

const publikKeyPem = pki.publicKeyToPem(cert.publicKey);

pemPublicKeyToCryptoKey(publicKeyPem);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published