20260711 验证TAL信任锚自签名
This commit is contained in:
@@ -88,6 +88,18 @@ fn offline_discovery_from_apnic_tal_and_ta_der_fixture_works() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn offline_discovery_rejects_tampered_ta_self_signature() {
|
||||
let tal_bytes = apnic_tal_bytes();
|
||||
let mut ta_der = apnic_ta_der();
|
||||
let last = ta_der.last_mut().expect("TA fixture must not be empty");
|
||||
*last ^= 0x01;
|
||||
|
||||
let err = discover_root_ca_instance_from_tal_and_ta_der(&tal_bytes, &ta_der, None)
|
||||
.expect_err("tampered TA signature must not form a root CA instance");
|
||||
assert!(err.to_string().contains("self-signature"), "{err}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn discover_root_from_tal_url_works_with_mock_fetcher() {
|
||||
let tal_bytes = apnic_tal_bytes();
|
||||
|
||||
Reference in New Issue
Block a user