decrypt static method
Decrypts the given encrypted value using the given key pair.
Implementation
/*
* @param {Buffer|Uint8Array|BC|String} value
* @param {Object} options
*
* @return {BC|false}
*/
static Uint8List decrypt(Uint8List value, PrivateKey privateKey) {
EciesData keyData = EciesCoding.decodeFromBytes(value);
ECDHResult dec = ECDHCrypt.decrypt(keyData.encryptedData!, privateKey,
publicKey: keyData.publicKey,
origMsgLength: keyData.originalDataLength);
Uint8List mac = PDUtil.hmacMd5(keyData.encryptedData!, dec.key);
if (ListEquality().equals(keyData.mac, mac)) {
return dec.data;
}
throw Exception('Unable to decrypt value.');
}