Skip to main content

Signature

Struct Signature 

Source
pub struct Signature {
Show 19 fields pub field_name: String, pub filter: Option<String>, pub sub_filter: Option<String>, pub name: Option<String>, pub signing_time: Option<String>, pub location: Option<String>, pub reason: Option<String>, pub contact_info: Option<String>, pub coverage: ByteRangeCoverage, pub digest: DigestStatus, pub crypto: CryptoStatus, pub digest_algorithm: Option<String>, pub signature_algorithm: Option<String>, pub signer_common_name: Option<String>, pub cms_blob: Option<Vec<u8>>, pub has_timestamp: bool, pub cert_count: usize, pub has_dss: bool, pub revocation: RevocationStatus,
}
Expand description

A digital signature attached to a /Sig form field.

Fields§

§field_name: String

The fully-qualified name of the signature field (/T chain).

§filter: Option<String>

/Filter — the security handler that produced the signature (conventionally Adobe.PPKLite).

§sub_filter: Option<String>

/SubFilter — the encoding of the signed data, e.g. adbe.pkcs7.detached, adbe.pkcs7.sha1, or ETSI.CAdES.detached (PAdES).

§name: Option<String>

/Name — the signer’s name as declared in the dictionary (not cryptographically bound; see Signature::signer_common_name).

§signing_time: Option<String>

/M — the signing time, as the raw PDF date string.

§location: Option<String>

/Location.

§reason: Option<String>

/Reason.

§contact_info: Option<String>

/ContactInfo.

§coverage: ByteRangeCoverage

The signed spans of the file (/ByteRange) and what they cover.

§digest: DigestStatus

Result of comparing the recomputed digest of the covered bytes to the digest embedded in the CMS blob.

§crypto: CryptoStatus

Result of verifying the signer’s public-key signature over the CMS signed attributes, using the first embedded certificate’s public key.

§digest_algorithm: Option<String>

Human name of the digest algorithm named by the CMS SignerInfo (SHA-1, SHA-256, …), when it could be identified.

§signature_algorithm: Option<String>

Human name of the signature (public-key) algorithm identified from the CMS SignerInfo and the signer certificate (RSA, ECDSA (P-256), …), when it could be identified.

§signer_common_name: Option<String>

The Common Name (CN) of the first certificate in the CMS blob — typically, but not guaranteed to be, the signer’s leaf certificate. Best-effort; None when no certificate / CN could be extracted.

§cms_blob: Option<Vec<u8>>

The raw CMS SignedData blob (/Contents), for follow-up checks such as certificate-chain verification (crate::trust). None when the dictionary carried no string /Contents.

§has_timestamp: bool

True when the CMS carries an RFC 3161 timestamp token in its unsignedAttrs (a signature-time-stamp attribute). Best-effort detection by OID scan; the TSA signature itself is not verified.

§cert_count: usize

Number of certificates embedded in the CMS certificates set (the signer cert plus any chain), best-effort.

§has_dss: bool

Whether the document carries a /DSS (Document Security Store) on its catalog — certs/CRLs/OCSP for LTV. None resolution falls back to false.

§revocation: RevocationStatus

Offline revocation status derived from CRLs embedded in the CMS or the /DSS. No network fetching is performed.

Implementations§

Source§

impl Signature

Source

pub fn is_cryptographically_valid(&self) -> bool

True only when both checks pass: the signed bytes are intact (DigestStatus::Verified) and the signer’s signature over the signed attributes verifies against the embedded certificate’s public key (CryptoStatus::Valid).

This still does not establish trust: the certificate is not validated against any anchor, nor checked for revocation. A true here means “cryptographically sound, from the private key matching the embedded certificate” — the certificate’s trustworthiness is a separate, out-of-scope question.

Trait Implementations§

Source§

impl Clone for Signature

Source§

fn clone(&self) -> Signature

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Signature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more