Also, here is the error from using 
crypto.createSign.update('msg').sign(privateKey, 'hex') due to the export 
of crypto.DiffieHellman.generateKeys lack of ascii output / 
crypto.createSign.update('msg').sign(privKey, 'hex') lack of anything but 
ascii input

139797041080096:error:0906D06C:PEM routines:PEM_read_bio:no start 
line:../deps/openssl/openssl/crypto/pem/pem_lib.c:703:Expecting: ANY 
PRIVATE KEY

On Monday, March 3, 2014 10:49:01 AM UTC-7, jas wrote:
>
> Hello, thanks for the response!
>
> Perhaps my original question would be better to include a more robust use 
> case: https://gist.github.com/jas-/9330405
>
> Attempting to specify privKey.toString('hex') would not work in that use 
> case due to crypto.DiffieHellman.generateKeys() only exporting binary, hex 
> or base64 private key formats.
>
> On Monday, March 3, 2014 10:01:56 AM UTC-7, Fedor Indutny wrote:
>>
>> Hi! 
>>
>> It is just a convenience thing, the key itself is usually PEM encoded and 
>> you could pass it as a string or Buffer, without any additional encoding 
>> set. 
>>
>> However, if you do following thing: 
>>
>> var key = fs.readFileSync('key.pem').toString('hex'); 
>> s.sign(key, 'hex'); 
>>
>> The additional encoding param could suddenly become useful ;) 
>>
>> So, answering your question - it is a design decision. 
>>
>> On Mon, Mar 3, 2014 at 8:56 PM, jas <[email protected]> wrote: 
>> > Does anyone know if the privKey arg when using 
>> > crypto.createSign().update(ct).sign(privKey, encoding) can be a buffer, 
>> hex 
>> > encoding string etc? 
>> > 
>> > It seems (according to the docs & source) that it requires an ascii PEM 
>> > (L#2974) formatted private key, which eliminates the use of the 
>> > crypto.DiffieHellman.generateKeys() private key as its only output 
>> options 
>> > are binary, hex or base64. 
>> > 
>> > Is this a design decision? 
>> > 
>> > -- 
>> > -- 
>> > Job Board: http://jobs.nodejs.org/ 
>> > Posting guidelines: 
>> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
>> > You received this message because you are subscribed to the Google 
>> > Groups "nodejs" group. 
>> > To post to this group, send email to [email protected] 
>> > To unsubscribe from this group, send email to 
>> > [email protected] 
>> > For more options, visit this group at 
>> > http://groups.google.com/group/nodejs?hl=en?hl=en 
>> > 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "nodejs" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to [email protected]. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to