apple_codesign::embedded_signature

Trait Blob

Source
pub trait Blob<'a>
where Self: Sized,
{ // Required methods fn magic() -> u32; fn from_blob_bytes(data: &'a [u8]) -> Result<Self, AppleCodesignError>; fn serialize_payload(&self) -> Result<Vec<u8>, AppleCodesignError>; // Provided methods fn to_blob_bytes(&self) -> Result<Vec<u8>, AppleCodesignError> { ... } fn digest_with( &self, hash_type: DigestType, ) -> Result<Vec<u8>, AppleCodesignError> { ... } }
Expand description

Provides common features for a parsed blob type.

Required Methods§

Source

fn magic() -> u32

The header magic that identifies this format.

Source

fn from_blob_bytes(data: &'a [u8]) -> Result<Self, AppleCodesignError>

Attempt to construct an instance by parsing a bytes slice.

The slice begins with the 8 byte blob header denoting the magic and length.

Source

fn serialize_payload(&self) -> Result<Vec<u8>, AppleCodesignError>

Serialize the payload of this blob to bytes.

Does not include the magic or length header fields common to blobs.

Provided Methods§

Source

fn to_blob_bytes(&self) -> Result<Vec<u8>, AppleCodesignError>

Serialize this blob to bytes.

This is Blob::serialize_payload with the blob magic and length prepended.

Source

fn digest_with( &self, hash_type: DigestType, ) -> Result<Vec<u8>, AppleCodesignError>

Obtain the digest of the blob using the specified hasher.

Default implementation calls Blob::to_blob_bytes and digests that, which should always be correct.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> Blob<'a> for BlobData<'a>

Source§

impl<'a> Blob<'a> for CodeDirectoryBlob<'a>

Source§

impl<'a> Blob<'a> for BlobWrapperBlob<'a>

Source§

impl<'a> Blob<'a> for ConstraintsDerBlob<'a>

Source§

impl<'a> Blob<'a> for DetachedSignatureBlob<'a>

Source§

impl<'a> Blob<'a> for EmbeddedSignatureBlob<'a>

Source§

impl<'a> Blob<'a> for EmbeddedSignatureOldBlob<'a>

Source§

impl<'a> Blob<'a> for EntitlementsBlob<'a>

Source§

impl<'a> Blob<'a> for EntitlementsDerBlob<'a>

Source§

impl<'a> Blob<'a> for OtherBlob<'a>

Source§

impl<'a> Blob<'a> for RequirementBlob<'a>

Source§

impl<'a> Blob<'a> for RequirementSetBlob<'a>