pub struct PublicKeyBox<'s> { /* private fields */ }Expand description
A PublicKeyBox represents a minisign public key.
also can be output to a string and parse from a str.
Implementations§
Source§impl<'s> PublicKeyBox<'s>
impl<'s> PublicKeyBox<'s>
pub fn from_verifying_key( key: VerifyingKey, key_id: &[u8; 8], untrusted_comment: Option<&'s str>, ) -> Result<Self>
Sourcepub fn from_str(s: &'s str) -> Result<Self>
pub fn from_str(s: &'s str) -> Result<Self>
Parse a PublicKeyBox from str.
as it store in a file.
Sourcepub fn from_raw_str(s: &'s str) -> Result<Self>
pub fn from_raw_str(s: &'s str) -> Result<Self>
Get the public key from a raw string,without untrusted comment. only one line.
Sourcepub fn untrusted_comment(&self) -> Option<&'s str>
pub fn untrusted_comment(&self) -> Option<&'s str>
Get the untrusted comment.
Sourcepub fn verify<R>(
&self,
signature_box: &SignatureBox<'_>,
data_reader: R,
) -> Result<bool>where
R: Read,
pub fn verify<R>(
&self,
signature_box: &SignatureBox<'_>,
data_reader: R,
) -> Result<bool>where
R: Read,
Verify a signature with the public key.
§Arguments
signature_box- The signature to verifydata_reader- The data to verify
§Returns
A Result containing a boolean indicating whether the signature is valid
§Errors
ErrorKind::Io- If there is an error reading the dataErrorKind::PublicKey- If the public key is invalid or not matching the signatureErrorKind::PrehashedMismatch- If the signature is not prehashed
Trait Implementations§
Source§impl<'s> Clone for PublicKeyBox<'s>
impl<'s> Clone for PublicKeyBox<'s>
Source§fn clone(&self) -> PublicKeyBox<'s>
fn clone(&self) -> PublicKeyBox<'s>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'s> Debug for PublicKeyBox<'s>
impl<'s> Debug for PublicKeyBox<'s>
Source§impl Display for PublicKeyBox<'_>
impl Display for PublicKeyBox<'_>
Source§impl<'s> PartialEq for PublicKeyBox<'s>
impl<'s> PartialEq for PublicKeyBox<'s>
impl<'s> Eq for PublicKeyBox<'s>
impl<'s> StructuralPartialEq for PublicKeyBox<'s>
Auto Trait Implementations§
impl<'s> Freeze for PublicKeyBox<'s>
impl<'s> RefUnwindSafe for PublicKeyBox<'s>
impl<'s> Send for PublicKeyBox<'s>
impl<'s> Sync for PublicKeyBox<'s>
impl<'s> Unpin for PublicKeyBox<'s>
impl<'s> UnsafeUnpin for PublicKeyBox<'s>
impl<'s> UnwindSafe for PublicKeyBox<'s>
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