Skip to content
Browse files

crypto: fix password reading from prompt

WIP, the test doesn't work because openssl reads from /dev/tty, not stdin.
  • Loading branch information...
1 parent ac17dc1 commit 415c9fc816a4a81919d190442c0e4d124f99f4ff @bnoordhuis committed
Showing with 56 additions and 2 deletions.
  1. +0 −2 deps/openssl/openssl.gyp
  2. +30 −0 test/fixtures/password.key
  3. +26 −0 test/simple/test-crypto-password-key.js
View
2 deps/openssl/openssl.gyp
@@ -21,7 +21,6 @@
'OPENSSL_NO_RDRAND',
'OPENSSL_NO_GOST',
'OPENSSL_NO_HW_PADLOCK',
- 'OPENSSL_NO_TTY',
],
'sources': [
'openssl/ssl/bio_ssl.c',
@@ -576,7 +575,6 @@
'openssl/crypto/ts/ts_verify_ctx.c',
'openssl/crypto/txt_db/txt_db.c',
'openssl/crypto/ui/ui_compat.c',
- 'openssl/crypto/ui/ui_dummy.c',
'openssl/crypto/ui/ui_err.c',
'openssl/crypto/ui/ui_lib.c',
'openssl/crypto/ui/ui_openssl.c',
View
30 test/fixtures/password.key
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-256-CBC,FC85ADA3723B514E8C0AF0996D7A5D1A
+
+ATW+s2/D9LfFLsk/IDkSphVmuXsgHvBycv77TPFS2K8aVKP92acgEuZPnpGz/Bfw
+gXabq0jPHjMnn2yf4dyynlgEW2aLJ2j6t09FIQoV92lsE8CEVssWJ4wj3iiS6R7/
+b5s1NYEHdxL+ruH6+/8pxt/1FZ+spo26cH/XLC8nKNIeLtyj/hf+qtvf7DVsi8x7
+OKwTG4JRsNmGm2BMY1J+gmhkeKfcPm1kCefS7J1Ohj/xd/Q9346F+pekpcccVKt9
+bjAevkHu1osZYGH4fBKugIaIeDn6Ig71gKRZVfttSfjhf2iy44ZvpuGKOm1nc+WG
+7Am5SMLAVByKeQwdTn+AM38PzLSsobgcqVEBNsOBzLnrtsWvcx7nVbvkvr4ZhqNr
+PiZ/c+7lQz+z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/BTH5YWQxUrzoas4t5OKBD7B6UVg7RXDiODZZwwfy
+yslp7ipwwNqBOxpY8X4VwjAAiZF6w86MK88lhgjtVbTTbNrlVFSBBJV0I1QA3wKx
+0Ds+ICxPxJ2+Ujs91xZppJomycXeHmrMmXRmQJNdwhKgj6MikTP0qey3fK5umayn
+-----END RSA PRIVATE KEY-----
View
26 test/simple/test-crypto-password-key.js
@@ -0,0 +1,26 @@
+// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var common = require('../common');
+var assert = require('assert');
+var crypto = require('crypto');
+var fs = require('fs');
+
+var key = fs.readFileSync(common.fixturesDir + '/password.key');
+crypto.createCredentials({ key: key });

0 comments on commit 415c9fc

Please sign in to comment.
Something went wrong with that request. Please try again.