/// Checks wheter a certificate is listen on its CRL.
Checks wheter a certificate is listen on its CRL.
Checks wheter a certificate is listen on its CRL .
fn check_crl<C: AsRef<Cert>>(
        &self,
        cert: C,
        issuer: &ResourceCert,
        store: &mut CrlStore,
    ) -> Result<(), ValidationError> {
        let cert = cert.as_ref();
        let uri_list = match cert.crl_distribution() {
            Some(some) => some,
            None => return Ok(())
        };
        for uri in uri_list.iter() {
            let uri = match uri.into_rsync_uri() {
                Some(uri) => uri,
                None => continue
            };
            // If we already have that CRL, use it.
            if let Some(crl) = store.get(&uri) {
                if crl.contains(&cert.serial_number()) {
                    return Err(ValidationError)
                }
                else {
                    return Ok(())
                }
            }
            // Otherwise, try to load it, use it, and then store it.
            let bytes = match self.load_file(&uri, true) {
                Some(bytes) => bytes,
                _ => continue
            };
            let crl = match Crl::decode(bytes) {
                Ok(crl) => crl,
                Err(_) => continue
            };
            if crl.validate(issuer.as_ref().subject_public_key_info()).is_err() {
                continue
            }
            if crl.is_stale() {
                warn!("{}: stale CRL.", uri);
            }
            let revoked = crl.contains(&cert.serial_number());
            store.push(uri, crl);
            if revoked {
                return Err(ValidationError)
            }
            else {
                return Ok(())
            }
        }
        Err(ValidationError)
    }
fn check_crl < C : AsRef < Cert > > ( & self , cert : C , issuer : & ResourceCert , store : & mut CrlStore , ) -> Result < ( ) , ValidationError > { let cert = cert . as_ref ( ) ; let uri_list = match cert . crl_distribution ( ) { Some ( some ) => some , None => return Ok ( ( ) ) } ; for uri in uri_list . iter ( ) { let uri = match uri . into_rsync_uri ( ) { Some ( uri ) => uri , None => continue } ; // If we already have that CRL, use it. if let Some ( crl ) = store . get ( & uri ) { if crl . contains ( & cert . serial_number ( ) ) { return Err ( ValidationError ) } else { return Ok ( ( ) ) } } // Otherwise, try to load it, use it, and then store it. let bytes = match self . load_file ( & uri , true ) { Some ( bytes ) => bytes , _ => continue } ; let crl = match Crl :: decode ( bytes ) { Ok ( crl ) => crl , Err ( _ ) => continue } ; if crl . validate ( issuer . as_ref ( ) . subject_public_key_info ( ) ) . is_err ( ) { continue } if crl . is_stale ( ) { warn ! ( " " uri ) ; } let revoked = crl . contains ( & cert . serial_number ( ) ) ; store . push ( uri , crl ) ; if revoked { return Err ( ValidationError ) } else { return Ok ( ( ) ) } } Err ( ValidationError ) }
Checks wheter a certificate is listen on its CRL.
Checks wheter a certificate is listen on its CRL .
&self
cert
C
issuer
&ResourceCert
store
&mut CrlStore