diff options
Diffstat (limited to 'openpgp/examples')
-rw-r--r-- | openpgp/examples/encrypt-for.rs | 7 | ||||
-rw-r--r-- | openpgp/examples/notarize.rs | 7 | ||||
-rw-r--r-- | openpgp/examples/sign-detached.rs | 7 | ||||
-rw-r--r-- | openpgp/examples/sign.rs | 7 | ||||
-rw-r--r-- | openpgp/examples/wrap-literal.rs | 7 |
5 files changed, 25 insertions, 10 deletions
diff --git a/openpgp/examples/encrypt-for.rs b/openpgp/examples/encrypt-for.rs index a5d7150a..bc70e307 100644 --- a/openpgp/examples/encrypt-for.rs +++ b/openpgp/examples/encrypt-for.rs @@ -8,7 +8,7 @@ extern crate openpgp; use openpgp::armor; use openpgp::constants::DataFormat; use openpgp::serialize::stream::{ - wrap, LiteralWriter, Encryptor, EncryptionMode, + Message, LiteralWriter, Encryptor, EncryptionMode, }; fn main() { @@ -45,8 +45,11 @@ fn main() { let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[][..]) .expect("Failed to create an armored writer"); + // Stream an OpenPGP message. + let message = Message::new(sink); + // We want to encrypt a literal data packet. - let encryptor = Encryptor::new(wrap(sink), + let encryptor = Encryptor::new(message, &[], // No symmetric encryption. &recipients, mode) diff --git a/openpgp/examples/notarize.rs b/openpgp/examples/notarize.rs index c26e79af..6643e573 100644 --- a/openpgp/examples/notarize.rs +++ b/openpgp/examples/notarize.rs @@ -12,7 +12,7 @@ use openpgp::{ parse::PacketParserResult, serialize::Serialize, }; -use openpgp::serialize::stream::{wrap, LiteralWriter, Signer}; +use openpgp::serialize::stream::{Message, LiteralWriter, Signer}; fn main() { let args: Vec<String> = env::args().collect(); @@ -38,9 +38,12 @@ fn main() { let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[][..]) .expect("Failed to create an armored writer."); + // Stream an OpenPGP message. + let message = Message::new(sink); + // Now, create a signer that emits a detached signature. let mut signer = Signer::new( - wrap(sink), &tsks.iter().collect::<Vec<&openpgp::TPK>>()) + message, &tsks.iter().collect::<Vec<&openpgp::TPK>>()) .expect("Failed to create signer"); // Create a parser for the message to be notarized. diff --git a/openpgp/examples/sign-detached.rs b/openpgp/examples/sign-detached.rs index fca195b0..bc071ba6 100644 --- a/openpgp/examples/sign-detached.rs +++ b/openpgp/examples/sign-detached.rs @@ -5,7 +5,7 @@ use std::io; extern crate openpgp; use openpgp::armor; -use openpgp::serialize::stream::{wrap, Signer}; +use openpgp::serialize::stream::{Message, Signer}; fn main() { let args: Vec<String> = env::args().collect(); @@ -31,9 +31,12 @@ fn main() { let sink = armor::Writer::new(io::stdout(), armor::Kind::Signature, &[][..]) .expect("Failed to create armored writer."); + // Stream an OpenPGP message. + let message = Message::new(sink); + // Now, create a signer that emits a detached signature. let mut signer = Signer::detached( - wrap(sink), &tsks.iter().collect::<Vec<&openpgp::TPK>>()) + message, &tsks.iter().collect::<Vec<&openpgp::TPK>>()) .expect("Failed to create signer"); // Copy all the data. diff --git a/openpgp/examples/sign.rs b/openpgp/examples/sign.rs index 03117ed5..6b05a08c 100644 --- a/openpgp/examples/sign.rs +++ b/openpgp/examples/sign.rs @@ -6,7 +6,7 @@ use std::io; extern crate openpgp; use openpgp::armor; use openpgp::constants::DataFormat; -use openpgp::serialize::stream::{wrap, LiteralWriter, Signer}; +use openpgp::serialize::stream::{Message, LiteralWriter, Signer}; fn main() { let args: Vec<String> = env::args().collect(); @@ -32,9 +32,12 @@ fn main() { let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[][..]) .expect("Failed to create an armored writer."); + // Stream an OpenPGP message. + let message = Message::new(sink); + // Now, create a signer that emits a signature. let signer = Signer::new( - wrap(sink), &tsks.iter().collect::<Vec<&openpgp::TPK>>()) + message, &tsks.iter().collect::<Vec<&openpgp::TPK>>()) .expect("Failed to create signer"); // Then, create a literal writer to wrap the data in a literal diff --git a/openpgp/examples/wrap-literal.rs b/openpgp/examples/wrap-literal.rs index b7cea74e..9d9560e3 100644 --- a/openpgp/examples/wrap-literal.rs +++ b/openpgp/examples/wrap-literal.rs @@ -9,7 +9,7 @@ use std::io; extern crate openpgp; use openpgp::armor; use openpgp::constants::DataFormat; -use openpgp::serialize::stream::{wrap, LiteralWriter}; +use openpgp::serialize::stream::{Message, LiteralWriter}; fn main() { let args: Vec<String> = env::args().collect(); @@ -24,9 +24,12 @@ fn main() { let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[][..]) .expect("Failed to create armored writer."); + // Stream an OpenPGP message. + let message = Message::new(sink); + // Then, create a literal writer to wrap the data in a literal // message packet. - let mut literal = LiteralWriter::new(wrap(sink), DataFormat::Binary, + let mut literal = LiteralWriter::new(message, DataFormat::Binary, None, None) .expect("Failed to create literal writer"); |