summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-02-06 15:39:36 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-02-06 15:39:36 +0100
commit8692671395738ea21823cd20eda74e3af9376544 (patch)
tree2414a9bf495a6010542cf8366f0e86d58ea5a48e
parent29c0978382510ecf9d6748bed3c3934549893505 (diff)
openpgp: New public constructor PKESK::new.
- See #173.
-rw-r--r--openpgp/src/message/mod.rs2
-rw-r--r--openpgp/src/packet/pkesk.rs9
-rw-r--r--openpgp/src/parse/parse.rs4
3 files changed, 7 insertions, 8 deletions
diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs
index e2f6e785..fb81044a 100644
--- a/openpgp/src/message/mod.rs
+++ b/openpgp/src/message/mod.rs
@@ -1056,7 +1056,7 @@ mod tests {
#[allow(deprecated)]
packets.insert(
1,
- Packet::PKESK(PKESK::new_(
+ Packet::PKESK(PKESK::new(
KeyID::from_hex("0000111122223333").unwrap(),
PublicKeyAlgorithm::RSAEncrypt,
Ciphertext::RSA { c: MPI::new(&[]) }).unwrap()));
diff --git a/openpgp/src/packet/pkesk.rs b/openpgp/src/packet/pkesk.rs
index 823afff0..63d68182 100644
--- a/openpgp/src/packet/pkesk.rs
+++ b/openpgp/src/packet/pkesk.rs
@@ -35,9 +35,9 @@ pub struct PKESK {
impl PKESK {
/// Creates a new PKESK packet.
- pub(crate) fn new_(recipient: KeyID, pk_algo: PublicKeyAlgorithm,
- encrypted_session_key: Ciphertext)
- -> Result<PKESK> {
+ pub fn new(recipient: KeyID, pk_algo: PublicKeyAlgorithm,
+ encrypted_session_key: Ciphertext)
+ -> Result<PKESK> {
Ok(PKESK {
common: Default::default(),
version: 3,
@@ -226,8 +226,7 @@ impl Arbitrary for PKESK {
}
};
- PKESK::new_(KeyID::arbitrary(g),
- pk_algo, ciphertext).unwrap()
+ PKESK::new(KeyID::arbitrary(g), pk_algo, ciphertext).unwrap()
}
}
diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs
index 892f9982..38ce8088 100644
--- a/openpgp/src/parse/parse.rs
+++ b/openpgp/src/parse/parse.rs
@@ -2330,8 +2330,8 @@ impl PKESK {
}
let mpis = crypto::mpis::Ciphertext::parse(pk_algo, &mut php)?;
- let pkesk = php_try!(PKESK::new_(KeyID::from_bytes(&keyid),
- pk_algo, mpis));
+ let pkesk = php_try!(PKESK::new(KeyID::from_bytes(&keyid),
+ pk_algo, mpis));
php.ok(Packet::PKESK(pkesk))
}
}