diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/guide-exploring-openpgp.rs | 16 | ||||
-rw-r--r-- | examples/guide-the-keystore.rs | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/examples/guide-exploring-openpgp.rs b/examples/guide-exploring-openpgp.rs index cff65378..c4d15bf9 100644 --- a/examples/guide-exploring-openpgp.rs +++ b/examples/guide-exploring-openpgp.rs @@ -4,7 +4,7 @@ extern crate sequoia_openpgp as openpgp; use crate::openpgp::parse::Parse; fn main() { - let tpk = + let cert = "-----BEGIN PGP PUBLIC KEY BLOCK----- mQENBFpxtsABCADZcBa1Q3ZLZnju18o0+t8LoQuIIeyeUQ0H45y6xUqyrD5HSkVM @@ -36,8 +36,8 @@ fn main() { =lAie -----END PGP PUBLIC KEY BLOCK-----"; - // Parse the TPK. - let pile = openpgp::PacketPile::from_bytes(tpk).unwrap(); + // Parse the Cert. + let pile = openpgp::PacketPile::from_bytes(cert).unwrap(); // Iterate over children. for (i, p) in pile.children().enumerate() { @@ -47,12 +47,12 @@ fn main() { // Some space to make the output easier to parse. println!(); - // Parse into TPK. - let tpk = openpgp::TPK::from_packet_pile(pile).unwrap(); - println!("Fingerprint: {}", tpk.fingerprint()); + // Parse into Cert. + let cert = openpgp::Cert::from_packet_pile(pile).unwrap(); + println!("Fingerprint: {}", cert.fingerprint()); // List userids. - for (i, u) in tpk.userids().enumerate() { + for (i, u) in cert.userids().enumerate() { println!("{}: UID: {}, {} self-signature(s), {} certification(s)", i, u.userid(), u.self_signatures().len(), @@ -60,7 +60,7 @@ fn main() { } // List subkeys. - for (i, s) in tpk.subkeys().enumerate() { + for (i, s) in cert.subkeys().enumerate() { println!("{}: Fingerprint: {}, {} self-signature(s), {} certification(s)", i, s.key().fingerprint(), s.self_signatures().len(), diff --git a/examples/guide-the-keystore.rs b/examples/guide-the-keystore.rs index 51fcb857..d3dd5c7b 100644 --- a/examples/guide-the-keystore.rs +++ b/examples/guide-the-keystore.rs @@ -6,7 +6,7 @@ use sequoia::{core, store}; use crate::openpgp::parse::Parse; fn main() { - let tpk = + let cert = "-----BEGIN PGP PUBLIC KEY BLOCK----- mQENBFpxtsABCADZcBa1Q3ZLZnju18o0+t8LoQuIIeyeUQ0H45y6xUqyrD5HSkVM @@ -41,17 +41,17 @@ fn main() { // Provide some context. let ctx = core::Context::new().unwrap(); - // Parse TPK. - let tpk = openpgp::TPK::from_bytes(tpk).unwrap(); + // Parse Cert. + let cert = openpgp::Cert::from_bytes(cert).unwrap(); // Open a mapping. let mapping = store::Mapping::open(&ctx, store::REALM_CONTACTS, "default").unwrap(); - // Store the TPK. - mapping.import("Ἀριστοτέλης", &tpk).unwrap(); + // Store the Cert. + mapping.import("Ἀριστοτέλης", &cert).unwrap(); // Now let's get it back. - let tpk_ = mapping.lookup("Ἀριστοτέλης").unwrap().tpk().unwrap(); - assert_eq!(tpk.fingerprint(), tpk_.fingerprint()); + let cert_ = mapping.lookup("Ἀριστοτέλης").unwrap().cert().unwrap(); + assert_eq!(cert.fingerprint(), cert_.fingerprint()); } |