hanewinpgp
Version:
PGP / GnuPG / OpenPGP Message Encryption in JavaScript by Herbert Hanewinkel.
55 lines (36 loc) • 1.83 kB
Markdown
[![travis][travis-image]][travis-url]
[![npm][npm-image]][npm-url]
[![downloads][downloads-image]][downloads-url]
[![browserstack][browserstack-image]][browserstack-url]
[]: https://travis-ci.org/dossy/hanewinpgp.svg?branch=master
[]: https://travis-ci.org/dossy/hanewinpgp
[]: https://img.shields.io/npm/v/hanewinpgp.svg?style=flat
[]: https://npmjs.org/package/hanewinpgp
[]: https://img.shields.io/npm/dm/hanewinpgp.svg?style=flat
[]: https://npmjs.org/package/hanewinpgp
[]: https://www.browserstack.com/automate/badge.svg?badge_key=V0pHUTRQNjdqMkFLVWpIVzdKWE9VSjBUc2VxaW5COE1ja3JCRTVNL0Q5OD0tLS94L0RYcWZNaE42QktFRkZXM0U3a2c9PQ==--dab2e0ddbe89c16963bdd438126279364766f633
[]: https://www.browserstack.com/automate/public-build/V0pHUTRQNjdqMkFLVWpIVzdKWE9VSjBUc2VxaW5COE1ja3JCRTVNL0Q5OD0tLS94L0RYcWZNaE42QktFRkZXM0U3a2c9PQ==--dab2e0ddbe89c16963bdd438126279364766f633
A very minimal implementation of PGP message encryption/decryption
by Herbert Hanewinkel, originally posted to his site at
https://www.hanewin.net/encrypt/ and mirrored at
https://dossy.github.io/hanewinpgp/.
```
$ npm install --save hanewinpgp
```
```js
const hanewinpgp = require('hanewinpgp');
var pubkey = "ASCII armored public key here";
var plaintext = "your plaintext message here";
var key = hanewinpgp.extract(pubkey);
var encrypted = hanewinpgp.encrypt(key, plaintext);
// encrypted now contains ASCII armored encrypted message
```
You can try a [demo of this code][demo-url] right in your reasonably
modern web browser.
[]: https://dossy.github.io/hanewinpgp/demo-encrypt/
See [LICENSE](LICENSE) file.