[−][src]Struct sequoia_openpgp::parse::stream::DetachedVerifier
Verifies a detached signature.
Examples
use std::io::{self, Read}; use sequoia_openpgp as openpgp; use openpgp::{KeyHandle, Cert, Result}; use openpgp::parse::{Parse, stream::*}; use sequoia_openpgp::policy::StandardPolicy; let p = &StandardPolicy::new(); // This fetches keys and computes the validity of the verification. struct Helper {}; impl VerificationHelper for Helper { fn get_certs(&mut self, _ids: &[KeyHandle]) -> Result<Vec<Cert>> { Ok(Vec::new()) // Feed the Certs to the verifier here... } fn check(&mut self, structure: MessageStructure) -> Result<()> { Ok(()) // Implement your verification policy here. } } let signature = b"-----BEGIN PGP SIGNATURE----- wnUEABYKACcFglt+z/EWoQSOjDP6RiYzeXbZeXgGnAw0jdgsGQmQBpwMNI3YLBkA AHmUAP9mpj2wV0/ekDuzxZrPQ0bnobFVaxZGg7YzdlksSOERrwEA6v6czXQjKcv2 KOwGTamb+ajTLQ3YRG9lh+ZYIXynvwE= =IJ29 -----END PGP SIGNATURE-----"; let data = b"Hello World!"; let h = Helper {}; let mut v = DetachedVerifierBuilder::from_bytes(&signature[..])? .with_policy(p, None, h)?; v.verify_bytes(data)?;
Implementations
impl<'a, H: VerificationHelper> DetachedVerifier<'a, H>
[src]
pub fn verify_reader<R: Read>(&mut self, reader: R) -> Result<()>
[src]
Verifies the given data.
pub fn verify_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
Verifies the given data.
pub fn verify_bytes<B: AsRef<[u8]>>(&mut self, buf: B) -> Result<()>
[src]
Verifies the given data.
pub fn helper_ref(&self) -> &H
[src]
Returns a reference to the helper.
pub fn helper_mut(&mut self) -> &mut H
[src]
Returns a mutable reference to the helper.
pub fn into_helper(self) -> H
[src]
Recovers the helper.
Auto Trait Implementations
impl<'a, H> !RefUnwindSafe for DetachedVerifier<'a, H>
impl<'a, H> !Send for DetachedVerifier<'a, H>
impl<'a, H> !Sync for DetachedVerifier<'a, H>
impl<'a, H> Unpin for DetachedVerifier<'a, H> where
H: Unpin,
H: Unpin,
impl<'a, H> !UnwindSafe for DetachedVerifier<'a, H>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,