From 2660b1295bfeceac2e75b9a7fbbfc442a0650a81 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 24 Dec 2023 19:09:56 -0500 Subject: [PATCH] Allow passing a passphrase callback when loading a public key --- openssl/src/pkey.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs index 8f0b5bdf7..42f40cec3 100644 --- a/openssl/src/pkey.rs +++ b/openssl/src/pkey.rs @@ -747,12 +747,22 @@ impl PKey { } impl PKey { - from_pem! { + private_key_from_pem! { /// Decodes a PEM-encoded SubjectPublicKeyInfo structure. /// /// The input should have a header of `-----BEGIN PUBLIC KEY-----`. #[corresponds(PEM_read_bio_PUBKEY)] public_key_from_pem, + + /// Decodes a PEM-encoded SubjectPublicKeyInfo structure. + #[corresponds(PEM_read_bio_PUBKEY)] + public_key_from_pem_passphrase, + + /// Decodes a PEM-encoded SubjectPublicKeyInfo structure. + /// + /// The callback should fill the password into the provided buffer and return its length. + #[corresponds(PEM_read_bio_PrivateKey)] + public_key_from_pem_callback, PKey, ffi::PEM_read_bio_PUBKEY } -- GitLab