Skip to content

Commit

Permalink
Merge pull request #2135 from alex/password-pem-public-key
Browse files Browse the repository at this point in the history
Allow passing a passphrase callback when loading a public key
  • Loading branch information
alex authored Dec 25, 2023
2 parents 4c98550 + d5b375a commit 93d172b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
run: |
case "${{ matrix.library.name }}" in
"openssl")
url="https://openssl.org/source${{ matrix.library.dl-path }}/openssl-${{ matrix.library.version }}.tar.gz"
url="https://www.openssl.org/source${{ matrix.library.dl-path }}/openssl-${{ matrix.library.version }}.tar.gz"
tar_flags="--strip-components=1"
;;
"libressl")
Expand Down
12 changes: 11 additions & 1 deletion openssl/src/pkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,12 +747,22 @@ impl PKey<Private> {
}

impl PKey<Public> {
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<Public>,
ffi::PEM_read_bio_PUBKEY
}
Expand Down

0 comments on commit 93d172b

Please sign in to comment.