Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cberthou/aes-gcm-rsa-oaep
https://github.com/cberthou/aes-gcm-rsa-oaep
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cberthou/aes-gcm-rsa-oaep
- Owner: cberthou
- Created: 2020-12-30T13:43:41.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-17T11:03:33.000Z (over 3 years ago)
- Last Synced: 2024-07-29T15:39:43.180Z (5 months ago)
- Language: TypeScript
- Size: 378 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
```