summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-06-22 12:09:19 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-06-29 12:56:12 +0200
commitfd900de3dc87d1c3ac93ec9e2992befd8d71c90a (patch)
tree7387f03425a520616109600c32f83b179e256911
parent1e9e70c93878a179504e9dbaed4b4f39c42f8ff4 (diff)
openpgp: Move the definition of `struct Signature`.
-rw-r--r--openpgp/src/lib.rs36
-rw-r--r--openpgp/src/signature.rs38
2 files changed, 38 insertions, 36 deletions
diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs
index 83752b5f..de9269a4 100644
--- a/openpgp/src/lib.rs
+++ b/openpgp/src/lib.rs
@@ -84,6 +84,7 @@ pub mod s2k;
mod unknown;
mod signature;
+pub use signature::Signature;
mod one_pass_sig;
mod key;
pub use key::SecretKey;
@@ -282,41 +283,6 @@ pub struct Unknown {
pub tag: Tag,
}
-/// Holds a signature packet.
-///
-/// Signature packets are used both for certification purposes as well
-/// as for document signing purposes.
-///
-/// See [Section 5.2 of RFC 4880] for details.
-///
-/// [Section 5.2 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2
-// Note: we can't derive PartialEq, because it includes the cached data.
-#[derive(Clone)]
-pub struct Signature {
- /// CTB packet header fields.
- pub common: packet::Common,
- /// Version of the signature packet. Must be 4.
- pub version: u8,
- /// Type of signature.
- pub sigtype: SignatureType,
- /// Public-key algorithm used for this signature.
- pub pk_algo: PublicKeyAlgorithm,
- /// Hash algorithm used to compute the signature.
- pub hash_algo: HashAlgorithm,
- /// Subpackets that are part of the signature.
- pub hashed_area: subpacket::SubpacketArea,
- /// Subpackets _not_ that are part of the signature.
- pub unhashed_area: subpacket::SubpacketArea,
- /// Lower 16 bits of the signed hash value.
- pub hash_prefix: [u8; 2],
- /// Signature MPIs. Must be a *Signature variant.
- pub mpis: mpis::MPIs,
-
- /// When used in conjunction with a one-pass signature, this is the
- /// hash computed over the enclosed message.
- pub computed_hash: Option<(HashAlgorithm, Vec<u8>)>,
-}
-
/// Holds a one-pass signature packet.
///
/// See [Section 5.4 of RFC 4880] for details.
diff --git a/openpgp/src/signature.rs b/openpgp/src/signature.rs
index df29eab5..1f08620f 100644
--- a/openpgp/src/signature.rs
+++ b/openpgp/src/signature.rs
@@ -6,12 +6,12 @@ use Result;
use mpis::MPIs;
use HashAlgorithm;
use PublicKeyAlgorithm;
-use Signature;
use SignatureType;
use Key;
use UserID;
use UserAttribute;
use Packet;
+use packet;
use subpacket::SubpacketArea;
use serialize::Serialize;
@@ -29,6 +29,42 @@ fn path_to(artifact: &str) -> PathBuf {
[env!("CARGO_MANIFEST_DIR"), "tests", "data", artifact]
.iter().collect()
}
+
+/// Holds a signature packet.
+///
+/// Signature packets are used both for certification purposes as well
+/// as for document signing purposes.
+///
+/// See [Section 5.2 of RFC 4880] for details.
+///
+/// [Section 5.2 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2
+// Note: we can't derive PartialEq, because it includes the cached data.
+#[derive(Clone)]
+pub struct Signature {
+ /// CTB packet header fields.
+ pub common: packet::Common,
+ /// Version of the signature packet. Must be 4.
+ pub version: u8,
+ /// Type of signature.
+ pub sigtype: SignatureType,
+ /// Public-key algorithm used for this signature.
+ pub pk_algo: PublicKeyAlgorithm,
+ /// Hash algorithm used to compute the signature.
+ pub hash_algo: HashAlgorithm,
+ /// Subpackets that are part of the signature.
+ pub hashed_area: SubpacketArea,
+ /// Subpackets _not_ that are part of the signature.
+ pub unhashed_area: SubpacketArea,
+ /// Lower 16 bits of the signed hash value.
+ pub hash_prefix: [u8; 2],
+ /// Signature MPIs. Must be a *Signature variant.
+ pub mpis: MPIs,
+
+ /// When used in conjunction with a one-pass signature, this is the
+ /// hash computed over the enclosed message.
+ pub computed_hash: Option<(HashAlgorithm, Vec<u8>)>,
+}
+
impl fmt::Debug for Signature {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Get the issuer. Prefer the issuer fingerprint to the