pub struct CleartextSignedMessage { /* private fields */ }
Expand description
Implementation of a Cleartext Signed Message.
Ref https://www.rfc-editor.org/rfc/rfc9580.html#name-cleartext-signature-framewo
Implementations§
Source§impl CleartextSignedMessage
impl CleartextSignedMessage
Sourcepub fn new<F>(
text: &str,
config: SignatureConfig,
key: &impl SecretKeyTrait,
key_pw: F,
) -> Result<Self>
pub fn new<F>( text: &str, config: SignatureConfig, key: &impl SecretKeyTrait, key_pw: F, ) -> Result<Self>
Construct a new cleartext message and sign it using the given key.
Sourcepub fn sign<R, F>(
rng: R,
text: &str,
key: &impl SecretKeyTrait,
key_pw: F,
) -> Result<Self>
pub fn sign<R, F>( rng: R, text: &str, key: &impl SecretKeyTrait, key_pw: F, ) -> Result<Self>
Sign the given text.
Sourcepub fn new_many<F>(text: &str, signer: F) -> Result<Self>
pub fn new_many<F>(text: &str, signer: F) -> Result<Self>
Sign the same message with multiple keys.
The signer function gets invoked with the normalized original text to be signed, and needs to produce the individual signatures.
Sourcepub fn signatures(&self) -> &[StandaloneSignature]
pub fn signatures(&self) -> &[StandaloneSignature]
The signature on the message.
Sourcepub fn verify(&self, key: &impl PublicKeyTrait) -> Result<&StandaloneSignature>
pub fn verify(&self, key: &impl PublicKeyTrait) -> Result<&StandaloneSignature>
Verify the signature against the normalized cleartext.
On success returns the first signature that verified against this key.
Sourcepub fn verify_many<F>(&self, verifier: F) -> Result<()>
pub fn verify_many<F>(&self, verifier: F) -> Result<()>
Verify each signature, potentially against a different key.
Sourcepub fn signed_text(&self) -> String
pub fn signed_text(&self) -> String
Normalizes the text to the format that was hashed for the signature. The output is normalized to “\r\n” line endings.
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
The “cleartext framework”-encoded (i.e. dash-escaped) form of the message.
Sourcepub fn from_armor<R: Read>(bytes: R) -> Result<(Self, Headers)>
pub fn from_armor<R: Read>(bytes: R) -> Result<(Self, Headers)>
Parse from an arbitrary reader, containing the text of the message.
Sourcepub fn from_string(input: &str) -> Result<(Self, Headers)>
pub fn from_string(input: &str) -> Result<(Self, Headers)>
Parse from string, containing the text of the message.
Sourcepub fn from_armor_buf<R: BufRead>(b: R) -> Result<(Self, Headers)>
pub fn from_armor_buf<R: BufRead>(b: R) -> Result<(Self, Headers)>
Parse from a buffered reader, containing the text of the message.
pub fn from_armor_after_header<R: BufRead>( b: R, headers: Headers, ) -> Result<(Self, Headers)>
pub fn to_armored_writer( &self, writer: &mut impl Write, opts: ArmorOptions<'_>, ) -> Result<()>
pub fn to_armored_bytes(&self, opts: ArmorOptions<'_>) -> Result<Vec<u8>>
pub fn to_armored_string(&self, opts: ArmorOptions<'_>) -> Result<String>
Trait Implementations§
Source§impl Clone for CleartextSignedMessage
impl Clone for CleartextSignedMessage
Source§fn clone(&self) -> CleartextSignedMessage
fn clone(&self) -> CleartextSignedMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more