Remove some stray manual impls
This commit is contained in:
parent
ccef9e339d
commit
7dbef567e6
|
|
@ -4,7 +4,7 @@ use libc::{c_int, c_char, c_void};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bio::{MemBio, MemBioSlice};
|
use bio::MemBioSlice;
|
||||||
use bn::BigNumRef;
|
use bn::BigNumRef;
|
||||||
use {cvt, cvt_p};
|
use {cvt, cvt_p};
|
||||||
use types::OpenSslTypeRef;
|
use types::OpenSslTypeRef;
|
||||||
|
|
@ -14,15 +14,7 @@ type_!(Dsa, DsaRef, ffi::DSA, ffi::DSA_free);
|
||||||
|
|
||||||
impl DsaRef {
|
impl DsaRef {
|
||||||
private_key_to_pem!(ffi::PEM_write_bio_DSAPrivateKey);
|
private_key_to_pem!(ffi::PEM_write_bio_DSAPrivateKey);
|
||||||
|
public_key_to_pem!(ffi::PEM_write_bio_DSA_PUBKEY);
|
||||||
/// Encodes a DSA public key as PEM formatted data.
|
|
||||||
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack> {
|
|
||||||
let mem_bio = try!(MemBio::new());
|
|
||||||
unsafe {
|
|
||||||
try!(cvt(ffi::PEM_write_bio_DSA_PUBKEY(mem_bio.as_ptr(), self.as_ptr())));
|
|
||||||
}
|
|
||||||
Ok(mem_bio.get_buf().to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
private_key_to_der!(ffi::i2d_DSAPrivateKey);
|
private_key_to_der!(ffi::i2d_DSAPrivateKey);
|
||||||
public_key_to_der!(ffi::i2d_DSAPublicKey);
|
public_key_to_der!(ffi::i2d_DSAPublicKey);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use std::mem;
|
||||||
use ffi;
|
use ffi;
|
||||||
|
|
||||||
use {cvt, cvt_p};
|
use {cvt, cvt_p};
|
||||||
use bio::{MemBio, MemBioSlice};
|
use bio::MemBioSlice;
|
||||||
use dh::Dh;
|
use dh::Dh;
|
||||||
use dsa::Dsa;
|
use dsa::Dsa;
|
||||||
use ec_key::EcKey;
|
use ec_key::EcKey;
|
||||||
|
|
@ -48,20 +48,12 @@ impl PKeyRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public_key_to_pem!(ffi::PEM_write_bio_PUBKEY);
|
||||||
private_key_to_pem!(ffi::PEM_write_bio_PKCS8PrivateKey);
|
private_key_to_pem!(ffi::PEM_write_bio_PKCS8PrivateKey);
|
||||||
|
|
||||||
private_key_to_der!(ffi::i2d_PrivateKey);
|
private_key_to_der!(ffi::i2d_PrivateKey);
|
||||||
public_key_to_der!(ffi::i2d_PUBKEY);
|
public_key_to_der!(ffi::i2d_PUBKEY);
|
||||||
|
|
||||||
/// Encodes the public key in the PEM format.
|
|
||||||
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack> {
|
|
||||||
let mem_bio = try!(MemBio::new());
|
|
||||||
unsafe {
|
|
||||||
try!(cvt(ffi::PEM_write_bio_PUBKEY(mem_bio.as_ptr(), self.as_ptr())));
|
|
||||||
}
|
|
||||||
Ok(mem_bio.get_buf().to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the size of the key.
|
/// Returns the size of the key.
|
||||||
///
|
///
|
||||||
/// This corresponds to the bit length of the modulus of an RSA key, and the bit length of the
|
/// This corresponds to the bit length of the modulus of an RSA key, and the bit length of the
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use libc::{c_int, c_void, c_char};
|
||||||
|
|
||||||
use {cvt, cvt_p, cvt_n};
|
use {cvt, cvt_p, cvt_n};
|
||||||
use bn::{BigNum, BigNumRef};
|
use bn::{BigNum, BigNumRef};
|
||||||
use bio::{MemBio, MemBioSlice};
|
use bio::MemBioSlice;
|
||||||
use error::ErrorStack;
|
use error::ErrorStack;
|
||||||
use util::{CallbackState, invoke_passwd_cb_old};
|
use util::{CallbackState, invoke_passwd_cb_old};
|
||||||
use types::OpenSslTypeRef;
|
use types::OpenSslTypeRef;
|
||||||
|
|
@ -23,17 +23,7 @@ type_!(Rsa, RsaRef, ffi::RSA, ffi::RSA_free);
|
||||||
|
|
||||||
impl RsaRef {
|
impl RsaRef {
|
||||||
private_key_to_pem!(ffi::PEM_write_bio_RSAPrivateKey);
|
private_key_to_pem!(ffi::PEM_write_bio_RSAPrivateKey);
|
||||||
|
public_key_to_pem!(ffi::PEM_write_bio_RSA_PUBKEY);
|
||||||
/// Writes an RSA public key as PEM formatted data
|
|
||||||
pub fn public_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack> {
|
|
||||||
let mem_bio = try!(MemBio::new());
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
try!(cvt(ffi::PEM_write_bio_RSA_PUBKEY(mem_bio.as_ptr(), self.as_ptr())));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(mem_bio.get_buf().to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
private_key_to_der!(ffi::i2d_RSAPrivateKey);
|
private_key_to_der!(ffi::i2d_RSAPrivateKey);
|
||||||
public_key_to_der!(ffi::i2d_RSA_PUBKEY);
|
public_key_to_der!(ffi::i2d_RSA_PUBKEY);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue