MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / tampered_ciphertext_fails

Function tampered_ciphertext_fails

nodedb-wal/src/crypto.rs:509–517  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508 #[test]
509 fn tampered_ciphertext_fails() {
510 let key = test_key();
511 let epoch = *key.epoch();
512 let header = test_header(1);
513
514 let mut ciphertext = key.encrypt(1, &header, b"secret").unwrap();
515 ciphertext[0] ^= 0xFF;
516 assert!(key.decrypt(&epoch, 1, &header, &ciphertext).is_err());
517 }
518
519 #[test]
520 fn tampered_header_fails() {

Callers

nothing calls this directly

Calls 4

test_headerFunction · 0.85
encryptMethod · 0.80
test_keyFunction · 0.70
epochMethod · 0.45

Tested by

no test coverage detected