Skip to content

Commit

Permalink
update getDiffieHellman docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thinred committed Jul 27, 2015
1 parent 571b928 commit 1eec927
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions doc/api/crypto.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -502,21 +502,21 @@ expected.
## crypto.getDiffieHellman(group_name)

Creates a predefined Diffie-Hellman key exchange object. The
supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC
2412][]) and `'modp14'`, `'modp15'`, `'modp16'`, `'modp17'`,
`'modp18'` (defined in [RFC 3526][]). The returned object mimics the
interface of objects created by [crypto.createDiffieHellman()][]
above, but will not allow to change the keys (with
[diffieHellman.setPublicKey()][] for example). The advantage of using
this routine is that the parties don't have to generate nor exchange
group modulus beforehand, saving both processor and communication
time.
supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in
[RFC 2412][], but see [Caveats](#crypto_caveats)) and `'modp14'`,
`'modp15'`, `'modp16'`, `'modp17'`, `'modp18'` (defined in
[RFC 3526][]). The returned object mimics the interface of objects
created by [crypto.createDiffieHellman()][] above, but will not allow
to change the keys (with [diffieHellman.setPublicKey()][] for
example). The advantage of using this routine is that the parties do
not have to generate nor exchange group modulus beforehand, saving
both processor and communication time.

Example (obtaining a shared secret):

var crypto = require('crypto');
var alice = crypto.getDiffieHellman('modp5');
var bob = crypto.getDiffieHellman('modp5');
var alice = crypto.getDiffieHellman('modp14');
var bob = crypto.getDiffieHellman('modp14');

alice.generateKeys();
bob.generateKeys();
Expand Down

0 comments on commit 1eec927

Please sign in to comment.