Skip to content

Comments

support passphase protected private key load#35

Merged
toddr merged 2 commits intocpan-authors:masterfrom
dxma:apply_patch_from_issue16
Mar 10, 2022
Merged

support passphase protected private key load#35
toddr merged 2 commits intocpan-authors:masterfrom
dxma:apply_patch_from_issue16

Conversation

@dxma
Copy link
Contributor

@dxma dxma commented Dec 7, 2021

Hi,

I applied the patch in issue #16 to latest code accordingly, which supports:

  1. read in encrypted / passphase protected private key in both PKCS1 and PKCS8 format, with new passphase parameter.
  2. create encrypted private key string in PKCS1 format, using given passphase and optional cipher parameters.

Test case updated.
Please review, I need this feature to replace some code working with Crypt::RSA.
Looking forward to merge and a new release on CPAN.

Cheers, Dongxu

Closes #16
Closes #19

Copy link
Collaborator

@atoomic atoomic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM some minor comments

BIO* stringBIO;
char* passphase = NULL;
STRLEN passphaseLength = 0;
char* cipher_name;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe init it to des3?

const EVP_CIPHER* enc = NULL;
CODE:
if (SvPOK(cipher_name_SV) && !SvPOK(passphase_SV)) {
croak("Both passphase and cipher name are required");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it s more: passphrase is missing consider adding a hint to your error message?

@toddr toddr merged commit e4c935c into cpan-authors:master Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Load encrypted private keys by taking $password as an arg [rt.cpan.org #47447] Patch to add functions to work with private keys [rt.cpan.org #122135]

3 participants