src/crypto/public_key/elliptic/ecdh.js
async function decrypt(oid, cipher_algo, hash_algo, V, C, d, fingerprint) {
  const curve = new Curve(oid);
  const { sharedKey } = await genPrivateEphemeralKey(curve, V, d);
  const param = buildEcdhParam(enums.publicKey.ecdh, oid, cipher_algo, hash_algo, fingerprint);
  cipher_algo = enums.read(enums.symmetric, cipher_algo);
  let err;
  for (let i = 0; i < 3; i++) {
    try {
      // Work around old go crypto bug and old OpenPGP.js bug, respectively.
      const Z = await kdf(hash_algo, sharedKey, cipher[cipher_algo].keySize, param, i === 1, i === 2);
      return new BN(aes_kw.unwrap(Z, C));
    } catch (e) {
      err = e;
    }
  }
  throw err;
}
async function decrypt(oid, cipher_algo, hash_algo, V, C, d, fingerprint) {
  const curve = new Curve(oid);
  const { sharedKey } = await genPrivateEphemeralKey(curve, V, d);
  const param = buildEcdhParam(enums.publicKey.ecdh, oid, cipher_algo, hash_algo, fingerprint);
  cipher_algo = enums.read(enums.symmetric, cipher_algo);
  let err;
  for (let i = 0; i < 3; i++) {
    try {
      // Work around old go crypto bug and old OpenPGP.js bug, respectively.
      const Z = await kdf(hash_algo, sharedKey, cipher[cipher_algo].keySize, param, i === 1, i === 2);
      return new BN(aes_kw.unwrap(Z, C));
    } catch (e) {
      err = e;
    }
  }
  throw err;
}
async function decrypt ( oid , cipher_algo , hash_algo , V , C , d , fingerprint ) { const curve = new Curve ( oid ) ; const { sharedKey } = await genPrivateEphemeralKey ( curve , V , d ) ; const param = buildEcdhParam ( enums . publicKey . ecdh , oid , cipher_algo , hash_algo , fingerprint ) ; cipher_algo = enums . read ( enums . symmetric , cipher_algo ) ; let err ; for ( let i = 0 ; i < 3 ; i ++ ) { try { // Work around old go crypto bug and old OpenPGP.js bug, respectively. const Z = await kdf ( hash_algo , sharedKey , cipher [ cipher_algo ] . keySize , param , i === 1 , i === 2 ) ; return new BN ( aes_kw . unwrap ( Z , C ) ) ; } catch ( e ) { err = e ; } } throw err ; }
Decrypt and unwrap the value derived from 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  {Uint8Array}             V            Public part of ephemeral key
@param  {Uint8Array}             C            Encrypted and wrapped value derived from session key
@param  {Uint8Array}             d            Recipient private key
@param  {String}                 fingerprint  Recipient fingerprint
@returns {Promise<BN>}                        Value derived from session
@async
Decrypt and unwrap the value derived from session key