|
3 | 3 |
|
4 | 4 | use crate::dscerror::DscError; |
5 | 5 | use crate::security::{add_file_as_checked, is_file_checked}; |
| 6 | +use rust_i18n::t; |
6 | 7 | use std::{ |
7 | 8 | ffi::OsStr, |
8 | 9 | mem::size_of, |
@@ -102,11 +103,11 @@ pub fn check_authenticode(file_path: &Path) -> Result<(), DscError> { |
102 | 103 | Ok(()) |
103 | 104 | } else { |
104 | 105 | match hresult { |
105 | | - TRUST_E_NOSIGNATURE => Err(DscError::AuthenticodeError(format!("The file '{}' is not signed.", file_path.display()))), |
106 | | - TRUST_E_EXPLICIT_DISTRUST => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' is explicitly distrusted.", file_path.display()))), |
107 | | - TRUST_E_SUBJECT_NOT_TRUSTED => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' is not trusted.", file_path.display()))), |
108 | | - CRYPT_E_SECURITY_SETTINGS => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' does not meet the security settings.", file_path.display()))), |
109 | | - _ => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' could not be verified. HRESULT: 0x{:X}", file_path.display(), hresult.0))), |
| 106 | + TRUST_E_NOSIGNATURE => Err(DscError::AuthenticodeError(t!("security.authenticode.fileNotSigned", file = file_path.display()).to_string())), |
| 107 | + TRUST_E_EXPLICIT_DISTRUST => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureExplicitlyDistrusted", file = file_path.display()).to_string())), |
| 108 | + TRUST_E_SUBJECT_NOT_TRUSTED => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureNotTrusted", file = file_path.display()).to_string())), |
| 109 | + CRYPT_E_SECURITY_SETTINGS => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureDoesNotMeetSecuritySettings", file = file_path.display()).to_string())), |
| 110 | + _ => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureCouldNotBeVerified", file = file_path.display(), hresult = hresult.0).to_string())), |
110 | 111 | } |
111 | 112 | } |
112 | 113 | } |
0 commit comments