[−][src]Enum pgp::composed::message::Message
Variants
Literal(LiteralData)
Compressed(CompressedData)
Fields of Signed
Methods
impl Message
[src]
pub fn new_literal(file_name: &str, data: &str) -> Self
[src]
pub fn new_literal_bytes(file_name: &str, data: &[u8]) -> Self
[src]
pub fn compress(&self, alg: CompressionAlgorithm) -> Result<Self>
[src]
Compresses the message.
pub fn decompress(self) -> Result<Self>
[src]
Decompresses the data if compressed.
pub fn encrypt_to_keys<R: CryptoRng + Rng>(
&self,
rng: &mut R,
alg: SymmetricKeyAlgorithm,
pkeys: &[&impl PublicKeyTrait]
) -> Result<Self>
[src]
&self,
rng: &mut R,
alg: SymmetricKeyAlgorithm,
pkeys: &[&impl PublicKeyTrait]
) -> Result<Self>
Encrypt the message to the list of passed in public keys.
pub fn encrypt_with_password<R, F>(
&self,
rng: &mut R,
s2k: StringToKey,
alg: SymmetricKeyAlgorithm,
msg_pw: F
) -> Result<Self> where
R: Rng + CryptoRng,
F: FnOnce() -> String + Clone,
[src]
&self,
rng: &mut R,
s2k: StringToKey,
alg: SymmetricKeyAlgorithm,
msg_pw: F
) -> Result<Self> where
R: Rng + CryptoRng,
F: FnOnce() -> String + Clone,
Encrytp the message using the given password.
pub fn sign<F>(
self,
key: &impl SecretKeyTrait,
key_pw: F,
hash_algorithm: HashAlgorithm
) -> Result<Self> where
F: FnOnce() -> String,
[src]
self,
key: &impl SecretKeyTrait,
key_pw: F,
hash_algorithm: HashAlgorithm
) -> Result<Self> where
F: FnOnce() -> String,
Sign this message using the provided key.
pub fn into_signature(self) -> StandaloneSignature
[src]
Convert the message to a standalone signature according to the cleartext framework.
pub fn verify(&self, key: &impl PublicKeyTrait) -> Result<()>
[src]
Verify this message. For signed messages this verifies the signature and for compressed messages they are decompressed and checked for signatures to verify.
pub fn get_recipients(&self) -> Vec<&KeyId>
[src]
Returns a list of KeyIds that the message is encrypted to. For non encrypted messages this list is empty.
pub fn decrypt<'a, F, G>(
&'a self,
msg_pw: F,
key_pw: G,
keys: &[&SignedSecretKey]
) -> Result<(MessageDecrypter<'a>, Vec<KeyId>)> where
F: FnOnce() -> String + Clone,
G: FnOnce() -> String + Clone,
[src]
&'a self,
msg_pw: F,
key_pw: G,
keys: &[&SignedSecretKey]
) -> Result<(MessageDecrypter<'a>, Vec<KeyId>)> where
F: FnOnce() -> String + Clone,
G: FnOnce() -> String + Clone,
Decrypt the message using the given key. Returns a message decrypter, and a list of KeyIds that are valid recipients of this message.
pub fn decrypt_with_password<'a, F>(
&'a self,
msg_pw: F
) -> Result<MessageDecrypter<'a>> where
F: FnOnce() -> String + Clone,
[src]
&'a self,
msg_pw: F
) -> Result<MessageDecrypter<'a>> where
F: FnOnce() -> String + Clone,
Decrypt the message using the given key. Returns a message decrypter, and a list of KeyIds that are valid recipients of this message.
pub fn is_one_pass_signed(&self) -> bool
[src]
Check if this message is a signature, that was signed with a one pass signature.
pub fn is_literal(&self) -> bool
[src]
pub fn get_literal(&self) -> Option<&LiteralData>
[src]
pub fn get_content(&self) -> Result<Option<Vec<u8>>>
[src]
Returns the underlying content and None
if the message is encrypted.
pub fn to_armored_writer(
&self,
writer: &mut impl Write,
headers: Option<&BTreeMap<String, String>>
) -> Result<()>
[src]
&self,
writer: &mut impl Write,
headers: Option<&BTreeMap<String, String>>
) -> Result<()>
pub fn to_armored_bytes(
&self,
headers: Option<&BTreeMap<String, String>>
) -> Result<Vec<u8>>
[src]
&self,
headers: Option<&BTreeMap<String, String>>
) -> Result<Vec<u8>>
pub fn to_armored_string(
&self,
headers: Option<&BTreeMap<String, String>>
) -> Result<String>
[src]
&self,
headers: Option<&BTreeMap<String, String>>
) -> Result<String>
Trait Implementations
impl Deserializable for Message
[src]
fn from_packets<'a>(
packets: impl Iterator<Item = Packet> + 'a
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
[src]
packets: impl Iterator<Item = Packet> + 'a
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
Parse a composed message. Ref: https://tools.ietf.org/html/rfc4880#section-11.3
fn from_bytes(bytes: impl Read) -> Result<Self>
[src]
fn from_string(input: &str) -> Result<(Self, BTreeMap<String, String>)>
[src]
fn from_string_many<'a>(
input: &'a str
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, BTreeMap<String, String>)>
[src]
input: &'a str
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, BTreeMap<String, String>)>
fn from_armor_single<R: Read + Seek>(
input: R
) -> Result<(Self, BTreeMap<String, String>)>
[src]
input: R
) -> Result<(Self, BTreeMap<String, String>)>
fn from_armor_many<'a, R: Read + Seek + 'a>(
input: R
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, BTreeMap<String, String>)>
[src]
input: R
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, BTreeMap<String, String>)>
fn from_bytes_many<'a>(
bytes: impl Read + 'a
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
[src]
bytes: impl Read + 'a
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
impl Serialize for Message
[src]
fn to_writer<W: Write>(&self, writer: &mut W) -> Result<()>
[src]
fn to_bytes(&self) -> Result<Vec<u8>>
[src]
impl Clone for Message
[src]
impl Eq for Message
[src]
impl PartialEq<Message> for Message
[src]
impl Debug for Message
[src]
impl StructuralPartialEq for Message
[src]
impl StructuralEq for Message
[src]
Auto Trait Implementations
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
impl RefUnwindSafe for Message
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,