aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-05-06 16:40:33 -0700
committerSteven Fackler <[email protected]>2017-05-06 16:40:33 -0700
commit67b5fd1c9750d3434adca8d700e265a5238de3be (patch)
tree9d29137337ef254d7488f65163642c249a21cd4c /openssl/src
parentAdd a note to rename variant (diff)
downloadrust-openssl-67b5fd1c9750d3434adca8d700e265a5238de3be.tar.xz
rust-openssl-67b5fd1c9750d3434adca8d700e265a5238de3be.zip
Support public key decode from DER
Closes #629
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/pkey.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs
index 31dc9d82..f8211b25 100644
--- a/openssl/src/pkey.rs
+++ b/openssl/src/pkey.rs
@@ -140,6 +140,7 @@ impl PKey {
private_key_from_pem!(PKey, ffi::PEM_read_bio_PrivateKey);
public_key_from_pem!(PKey, ffi::PEM_read_bio_PUBKEY);
+ public_key_from_der!(PKey, ffi::d2i_PUBKEY);
/// Deserializes a DER-formatted PKCS#8 private key, using a callback to retrieve the password
/// if the key is encrpyted.
@@ -311,6 +312,12 @@ mod tests {
}
#[test]
+ fn test_public_key_from_der() {
+ let key = include_bytes!("../test/key.der.pub");
+ PKey::public_key_from_der(key).unwrap();
+ }
+
+ #[test]
fn test_pem() {
let key = include_bytes!("../test/key.pem");
let key = PKey::private_key_from_pem(key).unwrap();