title: Javascript public/private key encryption
body: <p>I'd like to generate a public/private keypair in javascript, and use the public key to encrypt message and the private key to decrypt the message.</p>
  
  <p>I prefer native browser support over external libraries.
  How can I do this in JavaScript?</p>
  
  <p>Modern browsers implement <code>window.crypto.subtle.generateKey</code>.
  I can use it to generate ECDSA private/public keys to sign/verify messages, this works. But I cannot find a way how to use it to generate pub/private keys to encrypt/decrypt. If I try the generateKey for the recommended AES-GCM Algorithm, it generates just one cryptoKey, which can be probably used to both encrypt and decrypt. But I prefer to get a keypair (publib/private keys), not just a single key. Any suggestions?</p>
  
  <p>This table lists currently supported methods, but it seems none of the green algorithms is what I need:
  <a href="https://diafygi.github.io/webcrypto-examples/" rel="noreferrer">https://diafygi.github.io/webcrypto-examples/</a></p>