MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / test_dh_decrypt

Function test_dh_decrypt

dstack-util/src/crypto.rs:78–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77 #[test]
78 fn test_dh_decrypt() {
79 let secret: [u8; 32] =
80 hex::decode("7c282bf94b35dc47801dc953bfa0896fc2bd313381d3e8eca4e42f6536d2a96f")
81 .unwrap()
82 .try_into()
83 .unwrap();
84 let ciphertext = hex::decode("0bd18749612f4c8b9dd583c7d6a646b90abd34e3c731a7708d0caf9039095641e1f0948e775f0b7351788db7f246d51806954626dcccb6a60d64665ca3715c6bef75616cab476d27bba04080361200d6a58cec").unwrap();
85 let decrypted = dh_decrypt(secret, &ciphertext).unwrap();
86 let decrypted_str = String::from_utf8(decrypted).unwrap();
87 assert_eq!(decrypted_str, "[{\"key\":\"\",\"value\":\"\"}]");
88 }
89}

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.85
dh_decryptFunction · 0.85

Tested by

no test coverage detected