Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cberthou/aes-gcm-rsa-oaep


https://github.com/cberthou/aes-gcm-rsa-oaep

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# 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](https://github.com/bitnami-labs/sealed-secrets) encryption in JavaScript environments.

## Using x509 certificates

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

```shell script
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);
```