-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto: allow password protected private keys with publicEncrypt #626
Conversation
it requires some documentation, doesn't it? |
#625 conflicts with this one as it rewrites these methods |
though this is allowing something slightly different |
4d9ad0f
to
380e4bf
Compare
rebased with updates to the docs and I make sure that the functions that get exposed to the user aren't anonymous. |
and I'm geting a jshint failure one sec |
function rsaPublic(method, defaultPadding) { | ||
return function(options, buffer) { | ||
function makeRsaPublic(method, defaultPadding) { | ||
return function rsaPublic(options, buffer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rename makes the diff noisier than it needs to be.
380e4bf
to
058deb7
Compare
key: rsaKeyPemEncrypted, | ||
passphrase: 'password' | ||
}, encryptedBuffer); | ||
assert.equal(input, decryptedBufferWithPassword.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that tests decryption with a bad password? What if password is a buffer, an array, etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup can do
cc @iojs/crypto |
|
||
crypto.publicDecrypt({ | ||
key: rsaKeyPemEncrypted, | ||
passphrase: [].concat.apply([],new Buffer('password')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny style nit: space after comma.
LGTM assuming tests pass. I'm still not quite clear on why you renamed the methods. |
Oh sorry, I renamed them because I gave a name to the inner function and it On Sat, Jan 31, 2015, 5:12 AM Ben Noordhuis notifications@github.com
|
Private keys may be used along with publicEncrypt since the private key includes the public one. This adds the ability to use encrypted private keys which previously threw an error. This commit also makes sure the user exposed functions have names.
4a671a6
to
48a71db
Compare
Private keys may be used along with publicEncrypt since the private key includes the public one. This adds the ability to use encrypted private keys which previously threw an error. This commit also makes sure the user exposed functions have names. PR-URL: #626 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Thanks Calvin, landed in 6561274 with minor changes (reworded/reformatted the commit log and backed out the function renaming, it made the functions show up as |
Private keys may be used along with publicEncrypt since the private key includes
the public one. This adds the ability to use encrypted private keys which
previously threw an error.