parent
0efef98848
commit
67b5fd1c97
|
|
@ -2014,6 +2014,7 @@ extern {
|
|||
pub fn i2d_X509_REQ_bio(b: *mut BIO, x: *mut X509_REQ) -> c_int;
|
||||
pub fn i2d_X509_REQ(x: *mut X509_REQ, buf: *mut *mut u8) -> c_int;
|
||||
|
||||
pub fn d2i_PUBKEY(k: *mut *mut EVP_PKEY, buf: *mut *const u8, len: c_long) -> *mut EVP_PKEY;
|
||||
pub fn i2d_PUBKEY_bio(b: *mut BIO, x: *mut EVP_PKEY) -> c_int;
|
||||
pub fn i2d_PrivateKey_bio(b: *mut BIO, x: *mut EVP_PKEY) -> c_int;
|
||||
pub fn i2d_PUBKEY(k: *mut EVP_PKEY, buf: *mut *mut u8) -> c_int;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -310,6 +311,12 @@ mod tests {
|
|||
PKey::public_key_from_pem(key).unwrap();
|
||||
}
|
||||
|
||||
#[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");
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue