pub struct Code { /* private fields */ }Available on macOS and crate feature
full only.Expand description
Wraps SecCodeRef.
Implementations§
Source§impl Code
impl Code
Sourcepub fn current() -> Result<Self>
pub fn current() -> Result<Self>
Wraps the corresponding SecCodeRef operation.
Examples found in repository?
examples/07_code_signing_info.rs (line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let code = Code::current()?;
5 let static_code = code.static_code()?;
6 let signing = code.signing_information()?;
7 let task = Task::current()?;
8 println!(
9 "path={:?} signed={} task_identifier={:?} validity_ok={}",
10 static_code.path()?.display(),
11 signing.is_signed(),
12 task.signing_identifier()?,
13 static_code.check_validity().is_ok()
14 );
15 Ok(())
16}Sourcepub fn guest_with_attributes(
host: Option<&Self>,
attributes: Option<&Value>,
flags: CodeSigningFlags,
) -> Result<Self>
pub fn guest_with_attributes( host: Option<&Self>, attributes: Option<&Value>, flags: CodeSigningFlags, ) -> Result<Self>
Wraps the corresponding SecCodeRef operation.
Sourcepub fn static_code(&self) -> Result<StaticCode>
pub fn static_code(&self) -> Result<StaticCode>
Wraps the corresponding SecCodeRef operation.
Examples found in repository?
examples/07_code_signing_info.rs (line 5)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let code = Code::current()?;
5 let static_code = code.static_code()?;
6 let signing = code.signing_information()?;
7 let task = Task::current()?;
8 println!(
9 "path={:?} signed={} task_identifier={:?} validity_ok={}",
10 static_code.path()?.display(),
11 signing.is_signed(),
12 task.signing_identifier()?,
13 static_code.check_validity().is_ok()
14 );
15 Ok(())
16}pub fn guest_with_audit_token(audit_token: &AuditToken) -> Result<Self>
pub unsafe fn from_xpc_message(message: *mut c_void) -> Result<Self>
pub fn audit_token(&self) -> Option<AuditToken>
pub fn check_validity( &self, flags: CodeSigningFlags, requirement: Option<&Requirement>, ) -> Result<()>
Sourcepub fn signing_information(&self) -> Result<SigningInformation>
pub fn signing_information(&self) -> Result<SigningInformation>
Wraps the corresponding SecCodeRef operation.
Examples found in repository?
examples/07_code_signing_info.rs (line 6)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let code = Code::current()?;
5 let static_code = code.static_code()?;
6 let signing = code.signing_information()?;
7 let task = Task::current()?;
8 println!(
9 "path={:?} signed={} task_identifier={:?} validity_ok={}",
10 static_code.path()?.display(),
11 signing.is_signed(),
12 task.signing_identifier()?,
13 static_code.check_validity().is_ok()
14 );
15 Ok(())
16}Trait Implementations§
Auto Trait Implementations§
impl !Send for Code
impl !Sync for Code
impl Freeze for Code
impl RefUnwindSafe for Code
impl Unpin for Code
impl UnsafeUnpin for Code
impl UnwindSafe for Code
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more