summaryrefslogtreecommitdiff
path: root/openssl/src/pkey.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@palantir.com>2016-11-13 15:12:50 +0000
committerSteven Fackler <sfackler@palantir.com>2016-11-13 15:12:50 +0000
commit2a8923c05073d533175ed94d2931a3a79273a684 (patch)
treeabeccb6913cf808346a6e8ae9a2f04301db2255f /openssl/src/pkey.rs
parent08e0c4ca9061c3dc0c951db0c08909689b04a310 (diff)
downloadrust-openssl-2a8923c05073d533175ed94d2931a3a79273a684.zip
Macro-implement private_key_to_pem
Diffstat (limited to 'openssl/src/pkey.rs')
-rw-r--r--openssl/src/pkey.rs17
1 files changed, 1 insertions, 16 deletions
diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs
index a56633a2..27b36c4b 100644
--- a/openssl/src/pkey.rs
+++ b/openssl/src/pkey.rs
@@ -48,22 +48,7 @@ impl PKeyRef {
}
}
- /// Encodes the private key in the PEM format.
- // FIXME: also add password and encryption
- pub fn private_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack> {
- let mem_bio = try!(MemBio::new());
- unsafe {
- try!(cvt(ffi::PEM_write_bio_PrivateKey(mem_bio.as_ptr(),
- self.as_ptr(),
- ptr::null(),
- ptr::null_mut(),
- -1,
- None,
- ptr::null_mut())));
-
- }
- Ok(mem_bio.get_buf().to_owned())
- }
+ private_key_to_pem!(ffi::PEM_write_bio_PrivateKey);
/// Encodes the public key in the PEM format.
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack> {