aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-07-06 14:11:27 -1000
committerGitHub <[email protected]>2017-07-06 14:11:27 -1000
commit9290ed97c2c82580f9350f790529157d5e2a92c4 (patch)
treeaa789a62dc50d77fbbc606177195e4991fd83f0a /openssl/src
parentInform cargo about which env vars we care about (diff)
parentSupport PKCS#1 RSA public keys (diff)
downloadrust-openssl-9290ed97c2c82580f9350f790529157d5e2a92c4.tar.xz
rust-openssl-9290ed97c2c82580f9350f790529157d5e2a92c4.zip
Merge pull request #657 from sfackler/rsa-pkcs1
Support PKCS#1 RSA public keys
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/rsa.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/openssl/src/rsa.rs b/openssl/src/rsa.rs
index 31e1a349..22a9c36f 100644
--- a/openssl/src/rsa.rs
+++ b/openssl/src/rsa.rs
@@ -38,12 +38,16 @@ foreign_type! {
}
impl RsaRef {
+ // FIXME these need to specify output format
private_key_to_pem!(ffi::PEM_write_bio_RSAPrivateKey);
public_key_to_pem!(ffi::PEM_write_bio_RSA_PUBKEY);
private_key_to_der!(ffi::i2d_RSAPrivateKey);
public_key_to_der!(ffi::i2d_RSA_PUBKEY);
+ to_der_inner!(/// Serializes the public key to DER-encoded PKCS#1.
+ public_key_to_der_pkcs1, ffi::i2d_RSAPublicKey);
+
// FIXME should return u32
pub fn size(&self) -> usize {
unsafe {
@@ -255,11 +259,15 @@ impl Rsa {
}
}
+ // FIXME these need to identify input formats
private_key_from_pem!(Rsa, ffi::PEM_read_bio_RSAPrivateKey);
private_key_from_der!(Rsa, ffi::d2i_RSAPrivateKey);
public_key_from_pem!(Rsa, ffi::PEM_read_bio_RSA_PUBKEY);
public_key_from_der!(Rsa, ffi::d2i_RSA_PUBKEY);
+ from_der_inner!(/// Deserializes a public key from DER-encoded PKCS#1 data.
+ public_key_from_der_pkcs1, Rsa, ffi::d2i_RSAPublicKey);
+
#[deprecated(since = "0.9.2", note = "use private_key_from_pem_callback")]
pub fn private_key_from_pem_cb<F>(buf: &[u8], pass_cb: F) -> Result<Rsa, ErrorStack>
where F: FnOnce(&mut [c_char]) -> usize
@@ -440,5 +448,4 @@ mod test {
let len = k1.private_decrypt(&emesg, &mut dmesg, PKCS1_PADDING).unwrap();
assert_eq!(msg, &dmesg[..len]);
}
-
}