decrypt static method

PrivateKey decrypt(
  1. Uint8List value,
  2. String password
)

Decrypts a private key

Implementation

static PrivateKey decrypt(Uint8List value, String password) {
  Uint8List salt = value.sublist(8, 16);
  KeyIV key = KDF.pascalCoin(password, salt: salt);

  // Decrypt
  Uint8List encData = value.sublist(16);

  Uint8List privateKeyDecryptedAndEncoded =
      AesCbcPkcs7.decrypt(encData, key: key.key, iv: key.iv);

  return PrivateKeyCoder().decodeFromBytes(privateKeyDecryptedAndEncoded);
}