From 4469897ff9b9bcedb96f7a02337d51056dde54ab Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 5 Jun 2020 19:15:41 +0800 Subject: [PATCH] Fix private key serializtion in HasPublic impl for DsaRef --- openssl/src/dsa.rs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/openssl/src/dsa.rs b/openssl/src/dsa.rs index 2e4eda89..2231a79e 100644 --- a/openssl/src/dsa.rs +++ b/openssl/src/dsa.rs @@ -80,26 +80,6 @@ impl DsaRef where T: HasPublic, { - private_key_to_pem! { - /// Serializes the private key to a PEM-encoded DSAPrivateKey structure. - /// - /// The output will have a header of `-----BEGIN DSA PRIVATE KEY-----`. - /// - /// This corresponds to [`PEM_write_bio_DSAPrivateKey`]. - /// - /// [`PEM_write_bio_DSAPrivateKey`]: https://www.openssl.org/docs/man1.1.0/crypto/PEM_write_bio_DSAPrivateKey.html - private_key_to_pem, - /// Serializes the private key to a PEM-encoded encrypted DSAPrivateKey structure. - /// - /// The output will have a header of `-----BEGIN DSA PRIVATE KEY-----`. - /// - /// This corresponds to [`PEM_write_bio_DSAPrivateKey`]. - /// - /// [`PEM_write_bio_DSAPrivateKey`]: https://www.openssl.org/docs/man1.1.0/crypto/PEM_write_bio_DSAPrivateKey.html - private_key_to_pem_passphrase, - ffi::PEM_write_bio_DSAPrivateKey - } - to_pem! { /// Serialies the public key into a PEM-encoded SubjectPublicKeyInfo structure. /// @@ -136,6 +116,26 @@ impl DsaRef where T: HasPrivate, { + private_key_to_pem! { + /// Serializes the private key to a PEM-encoded DSAPrivateKey structure. + /// + /// The output will have a header of `-----BEGIN DSA PRIVATE KEY-----`. + /// + /// This corresponds to [`PEM_write_bio_DSAPrivateKey`]. + /// + /// [`PEM_write_bio_DSAPrivateKey`]: https://www.openssl.org/docs/man1.1.0/crypto/PEM_write_bio_DSAPrivateKey.html + private_key_to_pem, + /// Serializes the private key to a PEM-encoded encrypted DSAPrivateKey structure. + /// + /// The output will have a header of `-----BEGIN DSA PRIVATE KEY-----`. + /// + /// This corresponds to [`PEM_write_bio_DSAPrivateKey`]. + /// + /// [`PEM_write_bio_DSAPrivateKey`]: https://www.openssl.org/docs/man1.1.0/crypto/PEM_write_bio_DSAPrivateKey.html + private_key_to_pem_passphrase, + ffi::PEM_write_bio_DSAPrivateKey + } + /// Returns a reference to the private key component of `self`. pub fn priv_key(&self) -> &BigNumRef { unsafe {