OxL Справочник OxL
РусскийEnglish

data CryptoError

An authenticated decryption failed: wrong key, modified data or different associated data; or a key had the wrong size.

Example:

oxl✓ проверяется в CI
use std.crypto { aead, CryptoError }
use std.ser { bytesOf }

fn main() io, rand {
  let key = bytesOf(&"0123456789abcdef0123456789abcdef")
  let sealed = aead.seal(key, bytesOf(&"secret"))!
  let wrong = bytesOf(&"ffffffffffffffffffffffffffffffff")
  match aead.unseal(wrong, sealed) {
    bytes _ => print("opened")
    CryptoError _ => print("refused")
  }
}
Вывод
refused
@error pub(api) data CryptoError

Потокобезопасность. an immutable value.

С версии. 1.0.0-beta

Поля

pub(api) msg: str

What failed.

Определено в: std/crypto/crypto.oxl:62

См. также