diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-03-02 16:21:29 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-03-02 16:25:01 +0000 |
commit | 7a4369e240948cdc27c7ad03f40a42efbc52b95b (patch) | |
tree | 37eebb5922fef95d7ae3385057cd189e21d5a832 | |
parent | f7009e238a462cbce92b7701c3ff2587f6ac4626 (diff) | |
download | arti-7a4369e240948cdc27c7ad03f40a42efbc52b95b.tar.gz arti-7a4369e240948cdc27c7ad03f40a42efbc52b95b.zip |
tor-llcrypto: Add test case for RsaIdentity formatting
I'm going to change the code that does this, so add a test first
to check the output doesn't change.
At some point we should have more RSA tests.
-rw-r--r-- | crates/tor-llcrypto/tests/misc.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/tor-llcrypto/tests/misc.rs b/crates/tor-llcrypto/tests/misc.rs index 1a7760112..ff63791d0 100644 --- a/crates/tor-llcrypto/tests/misc.rs +++ b/crates/tor-llcrypto/tests/misc.rs @@ -38,6 +38,25 @@ fn test_ed25519_identity() { } #[test] +fn test_rsa_formatting() { + use ll::pk::rsa::RsaIdentity; + + let id = hex::decode("5696ab38cb3852afa476a5c07b2d4788963d5567").unwrap(); + let id = RsaIdentity::from_bytes(&id).unwrap(); + + assert_eq!( + format!("<<{}>>", id), + "<<$5696ab38cb3852afa476a5c07b2d4788963d5567>>" + ); + assert_eq!( + format!("{:?}", id), + "RsaIdentity { $5696ab38cb3852afa476a5c07b2d4788963d5567 }" + ); +} + +// TODO: Proper tests for RSA keys + +#[test] fn batch_verify() { use ll::pk::ed25519::*; use ll::util::rand_compat::RngCompatExt; |