diff options
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/examples/decrypt-with.rs | 34 | ||||
-rw-r--r-- | openpgp/examples/encrypt-for.rs | 10 | ||||
-rw-r--r-- | openpgp/examples/generate-encrypt-decrypt.rs | 18 | ||||
-rw-r--r-- | openpgp/examples/generate-sign-verify.rs | 22 | ||||
-rw-r--r-- | openpgp/examples/notarize.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/pad.rs | 10 | ||||
-rw-r--r-- | openpgp/examples/sign-detached.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/sign.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/statistics.rs | 70 | ||||
-rw-r--r-- | openpgp/examples/web-of-trust.rs | 16 | ||||
-rw-r--r-- | openpgp/src/armor.rs | 2 | ||||
-rw-r--r-- | openpgp/src/autocrypt.rs | 98 | ||||
-rw-r--r-- | openpgp/src/cert/bindings.rs (renamed from openpgp/src/tpk/bindings.rs) | 122 | ||||
-rw-r--r-- | openpgp/src/cert/builder.rs (renamed from openpgp/src/tpk/builder.rs) | 154 | ||||
-rw-r--r-- | openpgp/src/cert/keyiter.rs (renamed from openpgp/src/tpk/keyiter.rs) | 74 | ||||
-rw-r--r-- | openpgp/src/cert/mod.rs (renamed from openpgp/src/tpk/mod.rs) | 1070 | ||||
-rw-r--r-- | openpgp/src/cert/parser/low_level/grammar.lalrpop (renamed from openpgp/src/tpk/parser/low_level/grammar.lalrpop) | 26 | ||||
-rw-r--r-- | openpgp/src/cert/parser/low_level/grammar.rs | 2 | ||||
-rw-r--r-- | openpgp/src/cert/parser/low_level/lexer.rs (renamed from openpgp/src/tpk/parser/low_level/lexer.rs) | 8 | ||||
-rw-r--r-- | openpgp/src/cert/parser/low_level/mod.rs (renamed from openpgp/src/tpk/parser/low_level/mod.rs) | 16 | ||||
-rw-r--r-- | openpgp/src/cert/parser/mod.rs (renamed from openpgp/src/tpk/parser/mod.rs) | 302 | ||||
-rw-r--r-- | openpgp/src/cert/revoke.rs (renamed from openpgp/src/tpk/revoke.rs) | 142 | ||||
-rw-r--r-- | openpgp/src/crypto/hash.rs | 28 | ||||
-rw-r--r-- | openpgp/src/crypto/keygrip.rs | 6 | ||||
-rw-r--r-- | openpgp/src/crypto/mpis.rs | 6 | ||||
-rw-r--r-- | openpgp/src/lib.rs | 16 | ||||
-rw-r--r-- | openpgp/src/packet/key/mod.rs | 22 | ||||
-rw-r--r-- | openpgp/src/packet/pkesk.rs | 22 | ||||
-rw-r--r-- | openpgp/src/packet/signature/mod.rs | 28 | ||||
-rw-r--r-- | openpgp/src/packet/tag.rs | 6 | ||||
-rw-r--r-- | openpgp/src/parse/packet_parser_builder.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse/parse.rs | 70 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 118 | ||||
-rw-r--r-- | openpgp/src/serialize/cert.rs (renamed from openpgp/src/serialize/tpk.rs) | 290 | ||||
-rw-r--r-- | openpgp/src/serialize/cert_armored.rs (renamed from openpgp/src/serialize/tpk_armored.rs) | 66 | ||||
-rw-r--r-- | openpgp/src/serialize/mod.rs | 30 | ||||
-rw-r--r-- | openpgp/src/serialize/stream.rs | 50 | ||||
-rw-r--r-- | openpgp/src/tests.rs | 2 | ||||
-rw-r--r-- | openpgp/src/tpk/parser/low_level/grammar.rs | 2 | ||||
-rw-r--r-- | openpgp/tests/data/keys/really-revoked-cert-0-public.pgp (renamed from openpgp/tests/data/keys/really-revoked-tpk-0-public.pgp) | bin | 1751 -> 1751 bytes | |||
-rw-r--r-- | openpgp/tests/data/keys/really-revoked-cert-0-secret.pgp (renamed from openpgp/tests/data/keys/really-revoked-tpk-0-secret.pgp) | bin | 3693 -> 3693 bytes | |||
-rw-r--r-- | openpgp/tests/data/keys/really-revoked-cert-1-soft-revocation.pgp (renamed from openpgp/tests/data/keys/really-revoked-tpk-1-soft-revocation.pgp) | bin | 2223 -> 2223 bytes | |||
-rw-r--r-- | openpgp/tests/data/keys/really-revoked-cert-2-new-self-sig.pgp (renamed from openpgp/tests/data/keys/really-revoked-tpk-2-new-self-sig.pgp) | bin | 1751 -> 1751 bytes | |||
-rw-r--r-- | openpgp/tests/data/keys/really-revoked-cert-3-hard-revocation.pgp (renamed from openpgp/tests/data/keys/really-revoked-tpk-3-hard-revocation.pgp) | bin | 2204 -> 2204 bytes | |||
-rw-r--r-- | openpgp/tests/data/keys/really-revoked-cert-4-new-self-sig.pgp (renamed from openpgp/tests/data/keys/really-revoked-tpk-4-new-self-sig.pgp) | bin | 1751 -> 1751 bytes | |||
-rw-r--r-- | openpgp/tests/for-each-artifact.rs | 10 |
46 files changed, 1488 insertions, 1488 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs index d630a3e6..a290d14d 100644 --- a/openpgp/examples/decrypt-with.rs +++ b/openpgp/examples/decrypt-with.rs @@ -31,15 +31,15 @@ pub fn main() { } // Read the transferable secret keys from the given files. - let tpks = + let certs = args[1..].iter().map(|f| { - openpgp::TPK::from_file(f) + openpgp::Cert::from_file(f) .expect("Failed to read key") }).collect(); - // Now, create a decryptor with a helper using the given TPKs. + // Now, create a decryptor with a helper using the given Certs. let mut decryptor = - Decryptor::from_reader(io::stdin(), Helper::new(tpks), None).unwrap(); + Decryptor::from_reader(io::stdin(), Helper::new(certs), None).unwrap(); // Finally, stream the decrypted data to stdout. io::copy(&mut decryptor, &mut io::stdout()) @@ -54,12 +54,12 @@ struct Helper { } impl Helper { - /// Creates a Helper for the given TPKs with appropriate secrets. - fn new(tpks: Vec<openpgp::TPK>) -> Self { + /// Creates a Helper for the given Certs with appropriate secrets. + fn new(certs: Vec<openpgp::Cert>) -> Self { // Map (sub)KeyIDs to secrets. let mut keys = HashMap::new(); - for tpk in tpks { - for (sig, _, key) in tpk.keys_all() { + for cert in certs { + for (sig, _, key) in cert.keys_all() { if sig.map(|s| (s.key_flags().can_encrypt_at_rest() || s.key_flags().can_encrypt_for_transport())) .unwrap_or(false) @@ -99,15 +99,15 @@ impl DecryptionHelper for Helper { } } // XXX: In production code, return the Fingerprint of the - // recipient's TPK here + // recipient's Cert here Ok(None) } } impl VerificationHelper for Helper { fn get_public_keys(&mut self, _ids: &[openpgp::KeyHandle]) - -> failure::Fallible<Vec<openpgp::TPK>> { - Ok(Vec::new()) // Feed the TPKs to the verifier here. + -> failure::Fallible<Vec<openpgp::Cert>> { + Ok(Vec::new()) // Feed the Certs to the verifier here. } fn check(&mut self, structure: &MessageStructure) -> failure::Fallible<()> { @@ -126,18 +126,18 @@ impl VerificationHelper for Helper { MessageLayer::SignatureGroup { ref results } => for result in results { match result { - GoodChecksum { tpk, .. } => { - eprintln!("Good signature from {}", tpk); + GoodChecksum { cert, .. } => { + eprintln!("Good signature from {}", cert); }, - NotAlive { tpk, .. } => { + NotAlive { cert, .. } => { eprintln!("Good, but not alive signature from {}", - tpk); + cert); }, MissingKey { .. } => { eprintln!("No key to check signature"); }, - BadChecksum { tpk, .. } => { - eprintln!("Bad signature from {}", tpk); + BadChecksum { cert, .. } => { + eprintln!("Bad signature from {}", cert); }, } } diff --git a/openpgp/examples/encrypt-for.rs b/openpgp/examples/encrypt-for.rs index 50f9e35b..64d94b1c 100644 --- a/openpgp/examples/encrypt-for.rs +++ b/openpgp/examples/encrypt-for.rs @@ -28,16 +28,16 @@ fn main() { x), }; - // Read the transferable public keys from the given files. - let tpks: Vec<openpgp::TPK> = args[2..].iter().map(|f| { - openpgp::TPK::from_file(f) + // Read the certificates from the given files. + let certs: Vec<openpgp::Cert> = args[2..].iter().map(|f| { + openpgp::Cert::from_file(f) .expect("Failed to read key") }).collect(); // Build a vector of recipients to hand to Encryptor. let mut recipients = - tpks.iter() - .flat_map(|tpk| tpk.keys_valid().key_flags(mode.clone())) + certs.iter() + .flat_map(|cert| cert.keys_valid().key_flags(mode.clone())) .map(|(_, _, key)| key.into()) .collect::<Vec<_>>(); diff --git a/openpgp/examples/generate-encrypt-decrypt.rs b/openpgp/examples/generate-encrypt-decrypt.rs index ddba52e5..38487d52 100644 --- a/openpgp/examples/generate-encrypt-decrypt.rs +++ b/openpgp/examples/generate-encrypt-decrypt.rs @@ -26,19 +26,19 @@ fn main() { } /// Generates an encryption-capable key. -fn generate() -> openpgp::Result<openpgp::TPK> { - let (tpk, _revocation) = openpgp::tpk::TPKBuilder::new() +fn generate() -> openpgp::Result<openpgp::Cert> { + let (cert, _revocation) = openpgp::cert::CertBuilder::new() .add_userid("someone@example.org") .add_encryption_subkey() .generate()?; // Save the revocation certificate somewhere. - Ok(tpk) + Ok(cert) } /// Encrypts the given message. -fn encrypt(sink: &mut dyn Write, plaintext: &str, recipient: &openpgp::TPK) +fn encrypt(sink: &mut dyn Write, plaintext: &str, recipient: &openpgp::Cert) -> openpgp::Result<()> { // Build a vector of recipients to hand to Encryptor. let mut recipients = @@ -74,7 +74,7 @@ fn encrypt(sink: &mut dyn Write, plaintext: &str, recipient: &openpgp::TPK) } /// Decrypts the given message. -fn decrypt(sink: &mut dyn Write, ciphertext: &[u8], recipient: &openpgp::TPK) +fn decrypt(sink: &mut dyn Write, ciphertext: &[u8], recipient: &openpgp::Cert) -> openpgp::Result<()> { // Make a helper that that feeds the recipient's secret key to the // decryptor. @@ -82,7 +82,7 @@ fn decrypt(sink: &mut dyn Write, ciphertext: &[u8], recipient: &openpgp::TPK) secret: recipient, }; - // Now, create a decryptor with a helper using the given TPKs. + // Now, create a decryptor with a helper using the given Certs. let mut decryptor = Decryptor::from_bytes(ciphertext, helper, None)?; // Decrypt the data. @@ -92,12 +92,12 @@ fn decrypt(sink: &mut dyn Write, ciphertext: &[u8], recipient: &openpgp::TPK) } struct Helper<'a> { - secret: &'a openpgp::TPK, + secret: &'a openpgp::Cert, } impl<'a> VerificationHelper for Helper<'a> { fn get_public_keys(&mut self, _ids: &[openpgp::KeyHandle]) - -> openpgp::Result<Vec<openpgp::TPK>> { + -> openpgp::Result<Vec<openpgp::Cert>> { // Return public keys for signature verification here. Ok(Vec::new()) } @@ -129,6 +129,6 @@ impl<'a> DecryptionHelper for Helper<'a> { .and_then(|(algo, session_key)| decrypt(algo, &session_key)) .map(|_| None) // XXX: In production code, return the Fingerprint of the - // recipient's TPK here + // recipient's Cert here } } diff --git a/openpgp/examples/generate-sign-verify.rs b/openpgp/examples/generate-sign-verify.rs index f937dd84..a712e693 100644 --- a/openpgp/examples/generate-sign-verify.rs +++ b/openpgp/examples/generate-sign-verify.rs @@ -25,21 +25,21 @@ fn main() { } /// Generates an signing-capable key. -fn generate() -> openpgp::Result<openpgp::TPK> { - let (tpk, _revocation) = openpgp::tpk::TPKBuilder::new() +fn generate() -> openpgp::Result<openpgp::Cert> { + let (cert, _revocation) = openpgp::cert::CertBuilder::new() .add_userid("someone@example.org") .add_signing_subkey() .generate()?; // Save the revocation certificate somewhere. - Ok(tpk) + Ok(cert) } /// Signs the given message. -fn sign(sink: &mut dyn Write, plaintext: &str, tsk: &openpgp::TPK) +fn sign(sink: &mut dyn Write, plaintext: &str, tsk: &openpgp::Cert) -> openpgp::Result<()> { - // Get the keypair to do the signing from the TPK. + // Get the keypair to do the signing from the Cert. let keypair = tsk.keys_valid().signing_capable().nth(0).unwrap().2 .clone().mark_parts_secret().unwrap().into_keypair()?; @@ -63,15 +63,15 @@ fn sign(sink: &mut dyn Write, plaintext: &str, tsk: &openpgp::TPK) } /// Verifies the given message. -fn verify(sink: &mut dyn Write, signed_message: &[u8], sender: &openpgp::TPK) +fn verify(sink: &mut dyn Write, signed_message: &[u8], sender: &openpgp::Cert) -> openpgp::Result<()> { // Make a helper that that feeds the sender's public key to the // verifier. let helper = Helper { - tpk: sender, + cert: sender, }; - // Now, create a verifier with a helper using the given TPKs. + // Now, create a verifier with a helper using the given Certs. let mut verifier = Verifier::from_bytes(signed_message, helper, None)?; // Verify the data. @@ -81,14 +81,14 @@ fn verify(sink: &mut dyn Write, signed_message: &[u8], sender: &openpgp::TPK) } struct Helper<'a> { - tpk: &'a openpgp::TPK, + cert: &'a openpgp::Cert, } impl<'a> VerificationHelper for Helper<'a> { fn get_public_keys(&mut self, _ids: &[openpgp::KeyHandle]) - -> openpgp::Result<Vec<openpgp::TPK>> { + -> openpgp::Result<Vec<openpgp::Cert>> { // Return public keys for signature verification here. - Ok(vec![self.tpk.clone()]) + Ok(vec![self.cert.clone()]) } fn check(&mut self, structure: &MessageStructure) diff --git a/openpgp/examples/notarize.rs b/openpgp/examples/notarize.rs index 93ca53e1..c4694520 100644 --- a/openpgp/examples/notarize.rs +++ b/openpgp/examples/notarize.rs @@ -24,7 +24,7 @@ fn main() { // Read the transferable secret keys from the given files. let mut keys = Vec::new(); for filename in &args[1..] { - let tsk = openpgp::TPK::from_file(filename) + let tsk = openpgp::Cert::from_file(filename) .expect("Failed to read key"); let mut n = 0; diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs index f63cb105..9229c520 100644 --- a/openpgp/examples/pad.rs +++ b/openpgp/examples/pad.rs @@ -30,16 +30,16 @@ fn main() { x), }; - // Read the transferable public keys from the given files. - let tpks: Vec<openpgp::TPK> = args[2..].iter().map(|f| { - openpgp::TPK::from_file(f) + // Read the certificates from the given files. + let certs: Vec<openpgp::Cert> = args[2..].iter().map(|f| { + openpgp::Cert::from_file(f) .expect("Failed to read key") }).collect(); // Build a vector of recipients to hand to Encryptor. let mut recipients = - tpks.iter() - .flat_map(|tpk| tpk.keys_valid().key_flags(mode.clone())) + certs.iter() + .flat_map(|cert| cert.keys_valid().key_flags(mode.clone())) .map(|(_, _, key)| Recipient::new(KeyID::wildcard(), key)) .collect::<Vec<_>>(); diff --git a/openpgp/examples/sign-detached.rs b/openpgp/examples/sign-detached.rs index 8d5f9cfa..9990f770 100644 --- a/openpgp/examples/sign-detached.rs +++ b/openpgp/examples/sign-detached.rs @@ -20,7 +20,7 @@ fn main() { // Read the transferable secret keys from the given files. let mut keys = Vec::new(); for filename in &args[1..] { - let tsk = openpgp::TPK::from_file(filename) + let tsk = openpgp::Cert::from_file(filename) .expect("Failed to read key"); let mut n = 0; diff --git a/openpgp/examples/sign.rs b/openpgp/examples/sign.rs index 8ba0b018..296f6950 100644 --- a/openpgp/examples/sign.rs +++ b/openpgp/examples/sign.rs @@ -19,7 +19,7 @@ fn main() { // Read the transferable secret keys from the given files. let mut keys = Vec::new(); for filename in &args[1..] { - let tsk = openpgp::TPK::from_file(filename) + let tsk = openpgp::Cert::from_file(filename) .expect("Failed to read key"); let mut n = 0; diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs index acea38c1..90e1097d 100644 --- a/openpgp/examples/statistics.rs +++ b/openpgp/examples/statistics.rs @@ -63,11 +63,11 @@ fn main() { let mut p_aead: HashMap<Vec<AEADAlgorithm>, usize> = Default::default(); - // Per-TPK statistics. - let mut tpk_count = 0; - let mut tpk = PerTPK::min(); - let mut tpk_min = PerTPK::max(); - let mut tpk_max = PerTPK::min(); + // Per-Cert statistics. + let mut cert_count = 0; + let mut cert = PerCert::min(); + let mut cert_min = PerCert::max(); + let mut cert_max = PerCert::min(); // UserAttribute statistics. let mut ua_image_count = vec![0; 256]; @@ -100,18 +100,18 @@ fn main() { tags_count[i] += 1; match packet { - // If a new TPK starts, update TPK statistics. + // If a new Cert starts, update Cert statistics. Packet::PublicKey(_) | Packet::SecretKey(_) => { - if tpk_count > 0 { - tpk.update_min_max(&mut tpk_min, &mut tpk_max); + if cert_count > 0 { + cert.update_min_max(&mut cert_min, &mut cert_max); } - tpk_count += 1; - tpk = PerTPK::min(); + cert_count += 1; + cert = PerCert::min(); }, Packet::Signature(ref sig) => { sigs_count[u8::from(sig.typ()) as usize] += 1; - tpk.sigs[u8::from(sig.typ()) as usize] += 1; + cert.sigs[u8::from(sig.typ()) as usize] += 1; let mut signature = PerSignature::min(); for (_offset, len, sub) in sig.hashed_area().iter() @@ -120,7 +120,7 @@ fn main() { use crate::openpgp::packet::signature::subpacket::*; let i = u8::from(sub.tag()) as usize; sigs_subpacket_tags_count[i] += 1; - tpk.sigs_subpacket_tags_count[i] += 1; + cert.sigs_subpacket_tags_count[i] += 1; signature.subpacket_tags_count[i] += 1; if let SubpacketValue::Unknown(_) = sub.value() { sigs_subpacket_tags_unknown @@ -231,14 +231,14 @@ fn main() { tags_size_max[i] = n; } - tpk.bytes += n as usize; + cert.bytes += n as usize; } - tpk.packets += 1; - tpk.tags[i] += 1; + cert.packets += 1; + cert.tags[i] += 1; } } - tpk.update_min_max(&mut tpk_min, &mut tpk_max); + cert.update_min_max(&mut cert_min, &mut cert_max); } // Print statistics. |