summaryrefslogtreecommitdiffstats
path: root/openpgp/src
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src')
-rw-r--r--openpgp/src/armor.rs276
-rw-r--r--openpgp/src/build/build.rs1
-rw-r--r--openpgp/src/build/mod.rs2
-rw-r--r--openpgp/src/cert/amalgamation.rs1353
-rw-r--r--openpgp/src/cert/amalgamation/iter.rs388
-rw-r--r--openpgp/src/cert/amalgamation/key.rs1937
-rw-r--r--openpgp/src/cert/amalgamation/key/iter.rs1656
-rw-r--r--openpgp/src/cert/bindings.rs40
-rw-r--r--openpgp/src/cert/builder.rs829
-rw-r--r--openpgp/src/cert/bundle.rs848
-rw-r--r--openpgp/src/cert/component_iter.rs222
-rw-r--r--openpgp/src/cert/components.rs495
-rw-r--r--openpgp/src/cert/key_amalgamation.rs909
-rw-r--r--openpgp/src/cert/keyiter.rs1075
-rw-r--r--openpgp/src/cert/mod.rs2759
-rw-r--r--openpgp/src/cert/parser/low_level/grammar.lalrpop4
-rw-r--r--openpgp/src/cert/parser/low_level/grammar.rs1
-rw-r--r--openpgp/src/cert/parser/low_level/lexer.rs4
-rw-r--r--openpgp/src/cert/parser/mod.rs743
-rw-r--r--openpgp/src/cert/prelude.rs59
-rw-r--r--openpgp/src/cert/revoke.rs858
-rw-r--r--openpgp/src/crypto/aead.rs29
-rw-r--r--openpgp/src/crypto/asymmetric.rs60
-rw-r--r--openpgp/src/crypto/ecdh.rs12
-rw-r--r--openpgp/src/crypto/hash.rs122
-rw-r--r--openpgp/src/crypto/keygrip.rs89
-rw-r--r--openpgp/src/crypto/mem.rs24
-rw-r--r--openpgp/src/crypto/mod.rs32
-rw-r--r--openpgp/src/crypto/mpi.rs (renamed from openpgp/src/crypto/mpis.rs)17
-rw-r--r--openpgp/src/crypto/s2k.rs5
-rw-r--r--openpgp/src/crypto/sexp.rs141
-rw-r--r--openpgp/src/crypto/symmetric.rs16
-rw-r--r--openpgp/src/fingerprint.rs118
-rw-r--r--openpgp/src/fmt.rs68
-rw-r--r--openpgp/src/keyhandle.rs26
-rw-r--r--openpgp/src/keyid.rs150
-rw-r--r--openpgp/src/lib.rs245
-rw-r--r--openpgp/src/macros.rs1
-rw-r--r--openpgp/src/message/lexer.rs4
-rw-r--r--openpgp/src/message/mod.rs336
-rw-r--r--openpgp/src/packet/aed.rs166
-rw-r--r--openpgp/src/packet/compressed_data.rs58
-rw-r--r--openpgp/src/packet/container.rs402
-rw-r--r--openpgp/src/packet/header/ctb.rs91
-rw-r--r--openpgp/src/packet/header/mod.rs60
-rw-r--r--openpgp/src/packet/key.rs (renamed from openpgp/src/packet/key/mod.rs)1530
-rw-r--r--openpgp/src/packet/key/conversions.rs430
-rw-r--r--openpgp/src/packet/literal.rs39
-rw-r--r--openpgp/src/packet/marker.rs19
-rw-r--r--openpgp/src/packet/mdc.rs9
-rw-r--r--openpgp/src/packet/mod.rs1250
-rw-r--r--openpgp/src/packet/one_pass_sig.rs46
-rw-r--r--openpgp/src/packet/pkesk.rs119
-rw-r--r--openpgp/src/packet/prelude.rs70
-rw-r--r--openpgp/src/packet/seip.rs40
-rw-r--r--openpgp/src/packet/signature/mod.rs300
-rw-r--r--openpgp/src/packet/signature/subpacket.rs190
-rw-r--r--openpgp/src/packet/skesk.rs43
-rw-r--r--openpgp/src/packet/tag.rs16
-rw-r--r--openpgp/src/packet/trust.rs25
-rw-r--r--openpgp/src/packet/unknown.rs11
-rw-r--r--openpgp/src/packet/user_attribute.rs37
-rw-r--r--openpgp/src/packet/userid/mod.rs44
-rw-r--r--openpgp/src/packet_pile.rs370
-rw-r--r--openpgp/src/parse.rs (renamed from openpgp/src/parse/parse.rs)1249
-rw-r--r--openpgp/src/parse/hashed_reader.rs4
-rw-r--r--openpgp/src/parse/map.rs144
-rw-r--r--openpgp/src/parse/mod.rs94
-rw-r--r--openpgp/src/parse/mpis.rs70
-rw-r--r--openpgp/src/parse/packet_parser_builder.rs259
-rw-r--r--openpgp/src/parse/packet_pile_parser.rs344
-rw-r--r--openpgp/src/parse/partial_body.rs8
-rw-r--r--openpgp/src/parse/sexp/mod.rs2
-rw-r--r--openpgp/src/parse/stream.rs1564
-rw-r--r--openpgp/src/policy.rs214
-rw-r--r--openpgp/src/serialize.rs (renamed from openpgp/src/serialize/mod.rs)399
-rw-r--r--openpgp/src/serialize/cert.rs22
-rw-r--r--openpgp/src/serialize/cert_armored.rs7
-rw-r--r--openpgp/src/serialize/stream.rs2016
-rw-r--r--openpgp/src/serialize/stream/padding.rs (renamed from openpgp/src/serialize/padding.rs)92
-rw-r--r--openpgp/src/serialize/stream/partial_body.rs (renamed from openpgp/src/serialize/partial_body.rs)55
-rw-r--r--openpgp/src/serialize/stream/writer/mod.rs (renamed from openpgp/src/serialize/writer/mod.rs)182
-rw-r--r--openpgp/src/serialize/stream/writer/writer_bzip2.rs (renamed from openpgp/src/serialize/writer/writer_bzip2.rs)9
-rw-r--r--openpgp/src/serialize/stream/writer/writer_deflate.rs (renamed from openpgp/src/serialize/writer/writer_deflate.rs)15
-rw-r--r--openpgp/src/types/compression_level.rs (renamed from openpgp/src/serialize/writer/compression_common.rs)36
-rw-r--r--openpgp/src/types/features.rs57
-rw-r--r--openpgp/src/types/key_flags.rs54
-rw-r--r--openpgp/src/types/mod.rs490
-rw-r--r--openpgp/src/types/revocation_key.rs66
-rw-r--r--openpgp/src/types/server_preferences.rs70
-rw-r--r--openpgp/src/types/timestamp.rs212
-rw-r--r--openpgp/src/utils.rs22
92 files changed, 20968 insertions, 8107 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs
index 6f11958b..2425c804 100644
--- a/openpgp/src/armor.rs
+++ b/openpgp/src/armor.rs
@@ -1,8 +1,9 @@
//! ASCII Armor.
//!
-//! This module deals with ASCII Armored data (see [RFC 4880, section 6]).
+//! This module deals with ASCII Armored data (see [Section 6 of RFC
+//! 4880]).
//!
-//! [RFC 4880, section 6]: https://tools.ietf.org/html/rfc4880#section-6
+//! [Section 6 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-6
//!
//! # Scope
//!
@@ -33,6 +34,8 @@ use std::path::Path;
use std::cmp;
use std::str;
use std::borrow::Cow;
+
+#[cfg(any(test, feature = "quickcheck"))]
use quickcheck::{Arbitrary, Gen};
use crate::vec_truncate;
@@ -67,6 +70,7 @@ pub enum Kind {
File,
}
+#[cfg(any(test, feature = "quickcheck"))]
impl Arbitrary for Kind {
fn arbitrary<G: Gen>(g: &mut G) -> Self {
use self::Kind::*;
@@ -129,7 +133,7 @@ impl Kind {
/// This does not include any trailing newline. It is simply the
/// length of:
///
- /// ```norun
+ /// ```text
/// -----BEGIN PGP BLUB -----
/// ```
fn header_len(&self) -> usize {
@@ -140,7 +144,7 @@ impl Kind {
/// A filter that applies ASCII Armor to the data written to it.
pub struct Writer<W: Write> {
- sink: Option<W>,
+ sink: W,
kind: Kind,
stash: Vec<u8>,
column: usize,
@@ -152,12 +156,33 @@ pub struct Writer<W: Write> {
impl<W: Write> Writer<W> {
/// Constructs a new filter for the given type of data.
///
- /// Note: To ensure that we can handle errors during writing of
- /// the armor footer, this object must be consumed by calling
- /// [`Writer::finalize()`]. If the object