Skip to content

Certificate issuer returns subject #351

Description

@Scarjit

Expected Behaviour

.issuer() should return the certificate issuer

Current Behaviour

.issuer() returns the subject

Steps to reproduce

#[test]
#[ignore]
fn test_parse_cert_from_der(){
    let bob_der = std::fs::read("tests/assets/Bob.der").expect(".der file not found");
    let cert = certificate::Certificate::from_bytes(bob_der).expect("Failed to parse valid certificate");
    println!("{:?}", cert);
    println!("{:?}", cert.subject());
    println!("{:?}", cert.issuer());
}

(Replace Bob.der with any .der certificate you have)

Log output

Certificate { serial: Serial(BigUint { data: [15546172603236741066, 15287908600353094592] }), issuer: "CN=Ferdinand Linnenberg CA", subject: "CN=Bob", subject_pki: PublicKeyInfo(Rsa2048), data: Zeroizing([48, 130, 3, 95, 48, 130, 2, 71, 160, 3, 2, 1, 2, 2, 17, 0, 212, 41, 143, 223, 138, 175, 123, 192, 215, 191, 25, 157, 144, 213, 239, 202, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 34, 49, 32, 48, 30, 6, 3, 85, 4, 3, 12, 23, 70, 101, 114, 100, 105, 110, 97, 110, 100, 32, 76, 105, 110, 110, 101, 110, 98, 101, 114, 103, 32, 67, 65, 48, 30, 23, 13, 50, 50, 48, 50, 49, 48, 49, 50, 50, 53, 51, 55, 90, 23, 13, 50, 52, 48, 53, 49, 53, 49, 50, 50, 53, 51, 55, 90, 48, 14, 49, 12, 48, 10, 6, 3, 85, 4, 3, 12, 3, 66, 111, 98, 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 213, 39, 155, 153, 27, 58, 54, 100, 54, 200, 229, 120, 100, 182, 157, 112, 157, 41, 108, 14, 133, 145, 75, 120, 59, 220, 22, 195, 9, 140, 211, 116, 32, 140, 111, 237, 195, 144, 201, 27, 77, 128, 213, 70, 218, 82, 127, 210, 47, 188, 178, 247, 64, 141, 173, 221, 36, 185, 92, 220, 162, 33, 47, 72, 236, 6, 147, 139, 137, 240, 205, 99, 255, 161, 253, 206, 54, 213, 7, 122, 30, 14, 207, 104, 168, 193, 179, 127, 98, 132, 183, 225, 207, 37, 123, 63, 168, 60, 172, 7, 26, 253, 194, 225, 224, 158, 38, 36, 193, 13, 109, 157, 198, 87, 106, 180, 57, 40, 61, 136, 62, 201, 106, 137, 144, 114, 74, 123, 117, 197, 94, 27, 94, 92, 50, 84, 163, 255, 235, 1, 104, 127, 137, 180, 76, 1, 63, 8, 142, 108, 97, 73, 96, 38, 11, 38, 88, 129, 215, 26, 87, 238, 82, 92, 5, 71, 222, 218, 235, 181, 146, 157, 91, 206, 38, 24, 68, 89, 62, 39, 208, 97, 134, 226, 244, 198, 217, 199, 43, 31, 203, 234, 120, 240, 161, 169, 87, 215, 152, 76, 193, 47, 174, 106, 56, 180, 52, 83, 46, 90, 158, 248, 88, 199, 81, 231, 253, 184, 39, 205, 135, 114, 38, 193, 125, 20, 199, 205, 251, 242, 4, 138, 196, 143, 97, 207, 168, 120, 189, 33, 190, 40, 203, 232, 168, 101, 41, 40, 130, 70, 47, 24, 230, 255, 111, 83, 2, 3, 1, 0, 1, 163, 129, 163, 48, 129, 160, 48, 9, 6, 3, 85, 29, 19, 4, 2, 48, 0, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 181, 165, 240, 55, 37, 151, 173, 190, 241, 67, 82, 69, 77, 139, 160, 94, 233, 120, 33, 184, 48, 82, 6, 3, 85, 29, 35, 4, 75, 48, 73, 128, 20, 38, 78, 235, 176, 165, 27, 8, 168, 144, 42, 133, 4, 115, 132, 181, 165, 44, 97, 214, 145, 161, 38, 164, 36, 48, 34, 49, 32, 48, 30, 6, 3, 85, 4, 3, 12, 23, 70, 101, 114, 100, 105, 110, 97, 110, 100, 32, 76, 105, 110, 110, 101, 110, 98, 101, 114, 103, 32, 67, 65, 130, 9, 0, 140, 224, 64, 217, 216, 96, 229, 119, 48, 19, 6, 3, 85, 29, 37, 4, 12, 48, 10, 6, 8, 43, 6, 1, 5, 5, 7, 3, 2, 48, 11, 6, 3, 85, 29, 15, 4, 4, 3, 2, 7, 128, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 3, 130, 1, 1, 0, 25, 243, 235, 193, 149, 230, 213, 169, 51, 215, 46, 2, 216, 58, 145, 132, 129, 20, 147, 252, 3, 77, 177, 75, 157, 11, 155, 148, 147, 159, 26, 13, 135, 49, 161, 250, 166, 199, 58, 107, 24, 36, 18, 171, 40, 251, 200, 227, 9, 162, 93, 80, 73, 0, 217, 24, 230, 74, 9, 24, 224, 28, 218, 211, 25, 150, 61, 116, 114, 254, 224, 143, 238, 89, 84, 102, 46, 87, 114, 184, 145, 85, 6, 19, 229, 158, 137, 162, 58, 19, 59, 69, 48, 211, 205, 21, 14, 129, 235, 79, 176, 106, 164, 109, 0, 125, 91, 192, 74, 127, 151, 208, 39, 39, 49, 174, 62, 114, 241, 116, 254, 134, 142, 41, 169, 66, 35, 38, 34, 219, 8, 139, 223, 233, 211, 131, 141, 129, 16, 54, 215, 51, 104, 94, 203, 147, 203, 30, 18, 200, 203, 190, 94, 92, 142, 88, 176, 29, 6, 94, 201, 152, 183, 241, 73, 254, 196, 3, 222, 180, 43, 218, 157, 44, 125, 152, 55, 28, 108, 168, 149, 33, 111, 35, 227, 46, 9, 188, 108, 229, 237, 226, 80, 216, 247, 218, 69, 57, 216, 52, 138, 87, 12, 79, 208, 13, 128, 6, 214, 52, 99, 114, 39, 209, 80, 209, 210, 33, 44, 151, 87, 23, 152, 2, 149, 58, 150, 237, 117, 159, 204, 243, 184, 241, 58, 133, 249, 88, 8, 155, 160, 117, 253, 155, 253, 49, 221, 8, 220, 20, 61, 244, 104, 170, 212, 48]) }
"CN=Bob"
"CN=Bob"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions