mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-10-30 03:05:51 +01:00
Log debug message with policy error description
This commit is contained in:
parent
f046cd0fca
commit
48ff058234
1 changed files with 8 additions and 2 deletions
|
@ -30,13 +30,19 @@ use std::{
|
||||||
pub fn validate_cert(cert: &Cert) -> Result<ValidCert> {
|
pub fn validate_cert(cert: &Cert) -> Result<ValidCert> {
|
||||||
let validcert = match log_err!(cert.with_policy(&*POLICY, None), debug) {
|
let validcert = match log_err!(cert.with_policy(&*POLICY, None), debug) {
|
||||||
Ok(validcert) => validcert,
|
Ok(validcert) => validcert,
|
||||||
Err(_) => Err(SpecialErrors::InvalidCert)?,
|
Err(e) => {
|
||||||
|
debug!("Certificate was rejected: The primary key violates the policy: {}", e.source().unwrap());
|
||||||
|
Err(SpecialErrors::InvalidCert)?
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for key in cert.keys().subkeys() {
|
for key in cert.keys().subkeys() {
|
||||||
match log_err!(key.with_policy(&*POLICY, None), debug) {
|
match log_err!(key.with_policy(&*POLICY, None), debug) {
|
||||||
Ok(_) => continue,
|
Ok(_) => continue,
|
||||||
Err(_) => Err(SpecialErrors::KeyPolicyViolation)?,
|
Err(e) => {
|
||||||
|
debug!("Certificate was rejected: A sub key violates the policy: {}", e.source().unwrap());
|
||||||
|
Err(SpecialErrors::KeyPolicyViolation)?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue