OpenPGP: Key generation (ECC)PGP encryption allows for the encryption of email and with a signature from the sender. You can copy and paste your public key here [link]. We use the curve25519 curve in this example. The curve types used in this example are: 'curve25519', 'p256', 'p384', 'p521', 'secp256k1', 'curve25519', 'brainpoolP256r1', 'brainpoolP384r1', and 'brainpoolP512r1'. MethodPhil Zimmerman came up with the best way to achieve both the signing of an email and to preserve the privacy with PGP: With PGP, we sign a hash of the message with our private key, so that the other side can check the sender (and that the message hasn't been changed). We then create a new encryption key for every message, and then just need to encrypt this key with the other side's public key. The receiver then receives the message, and decrypts the email encryption key with her private key, and reads the message. After she takes a hash of the message, and then decrypts the encrypted hash with Bob's public key, and checks the result. If the values match, she has proven the sender and that the message hasn't been changed ... So what has gone wrong in the adoption of secure email? Well, we haven't found a method where users can easily register their public keys, and for software to support the proper signing of email. Microsoft Exchange has never really properly supported signing and encryption, and it is left to third-party plug-ins, which aren't easy to use. So, do you have a public key that you publicise? Here is my public key []: https://asecuritysite.com/encryption/pgp1 CodingThe code used: const openpgp = require('openpgp') var name1='bill'; var email1='[email protected]'; var args = process.argv; if (args.length>1) name=args[2]; if (args.length>2) email=args[3]; openpgp.initWorker({ path:'openpgp.worker.js' }) // set the relative web worker path var options = { userIds: [{ name:name1, email:email1 }], // multiple user IDs curve: "curve25519", passphrase: 'password' // protects the private key }; openpgp.generateKey(options).then(function(key) { var privkey = key.privateKeyArmored; var pubkey = key.publicKeyArmored; var revocationCertificate = key.revocationCertificate; console.log(pubkey); console.log(privkey); }); A sample run with 512-bit RSA keys is: -----BEGIN PGP PUBLIC KEY BLOCK----- Version: OpenPGP.js v4.4.5 Comment: https://openpgpjs.org xk0EXEOYvQECAIpLP8wfLxzgcolMpwgzcUzTlH0icggOIyuQKsHM4XNPugzU X0NeaawrJhfi+f8hDRojJ5Fv8jBI0m/KwFMNTT8AEQEAAc0UYmlsbCA8Ymls bEBob21lLmNvbT7CdQQQAQgAHwUCXEOYvQYLCQcIAwIEFQgKAgMWAgECGQEC GwMCHgEACgk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