decrypt method

Uint8List decrypt(
  1. Uint8List ciphertext, {
  2. Uint8List? label,
})

Decrypts ciphertext sealed with label, throwing RindError.decryptFailed if it does not decrypt.

Implementation

Uint8List decrypt(Uint8List ciphertext, {Uint8List? label}) {
  label ??= Uint8List(0);
  return nativeCopy(ciphertext, (input) {
    return nativeCopy(label!, (labelPointer) {
      return nativeCopy(Uint8List(_modulusLength), (out) {
        final len = check(
          _decrypt(
            _pointer,
            input,
            ciphertext.length,
            labelPointer,
            label!.length,
            out,
            _modulusLength,
          ),
        );
        return Uint8List.fromList(out.asTypedList(len));
      });
    });
  });
}