Commit 7a4369e2 authored by Ian Jackson's avatar Ian Jackson
Browse files

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.
parent f7009e23
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -37,6 +37,25 @@ fn test_ed25519_identity() {
    assert_eq!(ex3.as_bytes(), &example_key[..]);
}

#[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::*;