fn decode_revocation()

in cert-storage-inspector/src/main.rs [158:188]


fn decode_revocation(
    key: &[u8],
    value: &Option<Value>,
    typ: RevocationType,
    revocations: &mut BTreeSet<Revocation>,
) {
    match value {
        &Some(Value::I64(i)) if i == 1 => {}
        &Some(Value::I64(i)) if i == 0 => return,
        &None => return,
        &Some(_) => {
            eprintln!("unexpected value type for revocation entry");
            return;
        }
    }
    match split_der_key(key) {
        Ok((part1, part2)) => {
            let revocation = Revocation {
                typ,
                field1: base64::encode(part1),
                field2: base64::encode(part2),
            };
            if revocations.contains(&revocation) {
                eprintln!("duplicate entry in profile? ({:?})", revocation);
            } else {
                revocations.insert(revocation);
            }
        }
        Err(e) => eprintln!("error decoding key: {}", e.message),
    }
}