From 1ddc1dd61b45b41801c1d1c364cd6789314cb8f3 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 19 Nov 2019 15:50:23 +0100 Subject: openpgp: Use the builder pattern for stream::Signer. - See #375. --- openpgp/src/crypto/asymmetric.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'openpgp/src/crypto/asymmetric.rs') diff --git a/openpgp/src/crypto/asymmetric.rs b/openpgp/src/crypto/asymmetric.rs index 9232bd14..144bcc4c 100644 --- a/openpgp/src/crypto/asymmetric.rs +++ b/openpgp/src/crypto/asymmetric.rs @@ -27,6 +27,17 @@ pub trait Signer -> Result; } +impl Signer for Box> { + fn public(&self) -> &Key { + self.as_ref().public() + } + + fn sign(&mut self, hash_algo: HashAlgorithm, digest: &[u8]) + -> Result { + self.as_mut().sign(hash_algo, digest) + } +} + /// Decrypts a message. /// /// This is a low-level mechanism to decrypt an arbitrary OpenPGP -- cgit v1.2.3