pub struct PdfSigner {
pub certificate: Vec<u8>,
pub private_key: Vec<u8>,
pub reason: Option<String>,
pub location: Option<String>,
pub contact_info: Option<String>,
pub timestamp_url: Option<String>,
}Expand description
PDF 数字签名配置。
§Examples
use easypdf_core::crypto::PdfSigner;
let signer = PdfSigner::new(vec![0u8; 100], vec![0u8; 100])
.with_reason("Approval");
assert_eq!(signer.reason.as_deref(), Some("Approval"));Fields§
§certificate: Vec<u8>DER 编码的 X.509 证书,嵌入 PDF 签名中。
private_key: Vec<u8>DER 编码的私钥(PKCS#1 或 PKCS#8 格式)。
reason: Option<String>签名原因(如 “Approval”、“Reviewed”)。
location: Option<String>签名者位置。
contact_info: Option<String>签名者联系信息。
timestamp_url: Option<String>RFC 3161 时间戳服务器 URL(保留;尚未实现)。
Implementations§
Source§impl PdfSigner
impl PdfSigner
Sourcepub fn new(certificate: Vec<u8>, private_key: Vec<u8>) -> Self
pub fn new(certificate: Vec<u8>, private_key: Vec<u8>) -> Self
使用给定的 X.509 证书和私钥(DER 字节)创建新的签名者。
Sourcepub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
设置签名原因。
Sourcepub fn with_location(self, location: impl Into<String>) -> Self
pub fn with_location(self, location: impl Into<String>) -> Self
设置签名位置。
Sourcepub fn with_contact_info(self, info: impl Into<String>) -> Self
pub fn with_contact_info(self, info: impl Into<String>) -> Self
设置联系信息。
Sourcepub fn with_timestamp_url(self, url: impl Into<String>) -> Self
pub fn with_timestamp_url(self, url: impl Into<String>) -> Self
设置 RFC 3161 时间戳服务器 URL。
Auto Trait Implementations§
impl Freeze for PdfSigner
impl RefUnwindSafe for PdfSigner
impl Send for PdfSigner
impl Sync for PdfSigner
impl Unpin for PdfSigner
impl UnsafeUnpin for PdfSigner
impl UnwindSafe for PdfSigner
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more