src/crypto/public_key/elliptic/ecdh.js
async function encrypt(oid, cipher_algo, hash_algo, m, Q, fingerprint) {
  const curve = new Curve(oid);
  const { publicKey, sharedKey } = await genPublicEphemeralKey(curve, Q);
  const param = buildEcdhParam(enums.publicKey.ecdh, oid, cipher_algo, hash_algo, fingerprint);
  cipher_algo = enums.read(enums.symmetric, cipher_algo);
  const Z = await kdf(hash_algo, sharedKey, cipher[cipher_algo].keySize, param);
  const wrappedKey = aes_kw.wrap(Z, m.toString());
  return { publicKey, wrappedKey };
}
async function encrypt(oid, cipher_algo, hash_algo, m, Q, fingerprint) {
  const curve = new Curve(oid);
  const { publicKey, sharedKey } = await genPublicEphemeralKey(curve, Q);
  const param = buildEcdhParam(enums.publicKey.ecdh, oid, cipher_algo, hash_algo, fingerprint);
  cipher_algo = enums.read(enums.symmetric, cipher_algo);
  const Z = await kdf(hash_algo, sharedKey, cipher[cipher_algo].keySize, param);
  const wrappedKey = aes_kw.wrap(Z, m.toString());
  return { publicKey, wrappedKey };
}
async function encrypt ( oid , cipher_algo , hash_algo , m , Q , fingerprint ) { const curve = new Curve ( oid ) ; const { publicKey , sharedKey } = await genPublicEphemeralKey ( curve , Q ) ; const param = buildEcdhParam ( enums . publicKey . ecdh , oid , cipher_algo , hash_algo , fingerprint ) ; cipher_algo = enums . read ( enums . symmetric , cipher_algo ) ; const Z = await kdf ( hash_algo , sharedKey , cipher [ cipher_algo ] . keySize , param ) ; const wrappedKey = aes_kw . wrap ( Z , m . toString ( ) ) ; return { publicKey , wrappedKey } ; }
Encrypt and wrap a session key

@param  {module:type/oid}        oid          Elliptic curve object identifier
@param  {module:enums.symmetric} cipher_algo  Symmetric cipher to use
@param  {module:enums.hash}      hash_algo    Hash algorithm to use
@param  {module:type/mpi}        m            Value derived from session key (RFC 6637)
@param  {Uint8Array}             Q            Recipient public key
@param  {String}                 fingerprint  Recipient fingerprint
@returns {Promise<{V: BN, C: BN}>}            Returns public part of ephemeral key and encoded session key
@async
Encrypt and wrap a session key