File tree Expand file tree Collapse file tree 2 files changed +27
-27
lines changed Expand file tree Collapse file tree 2 files changed +27
-27
lines changed Original file line number Diff line number Diff line change @@ -388,3 +388,30 @@ common.expectsError(
388388 message : 'The "curve" argument must be of type string. ' +
389389 'Received type undefined'
390390 } ) ;
391+
392+ assert . throws (
393+ function ( ) {
394+ crypto . getDiffieHellman ( 'unknown-group' ) ;
395+ } ,
396+ / ^ E r r o r : U n k n o w n g r o u p $ / ,
397+ 'crypto.getDiffieHellman(\'unknown-group\') ' +
398+ 'failed to throw the expected error.'
399+ ) ;
400+ assert . throws (
401+ function ( ) {
402+ crypto . getDiffieHellman ( 'modp1' ) . setPrivateKey ( '' ) ;
403+ } ,
404+ new RegExp ( '^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' +
405+ 'setPrivateKey is not a function$' ) ,
406+ 'crypto.getDiffieHellman(\'modp1\').setPrivateKey(\'\') ' +
407+ 'failed to throw the expected error.'
408+ ) ;
409+ assert . throws (
410+ function ( ) {
411+ crypto . getDiffieHellman ( 'modp1' ) . setPublicKey ( '' ) ;
412+ } ,
413+ new RegExp ( '^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' +
414+ 'setPublicKey is not a function$' ) ,
415+ 'crypto.getDiffieHellman(\'modp1\').setPublicKey(\'\') ' +
416+ 'failed to throw the expected error.'
417+ ) ;
Original file line number Diff line number Diff line change @@ -27,33 +27,6 @@ if (!common.hasCrypto)
2727const assert = require ( 'assert' ) ;
2828const crypto = require ( 'crypto' ) ;
2929
30- assert . throws (
31- function ( ) {
32- crypto . getDiffieHellman ( 'unknown-group' ) ;
33- } ,
34- / ^ E r r o r : U n k n o w n g r o u p $ / ,
35- 'crypto.getDiffieHellman(\'unknown-group\') ' +
36- 'failed to throw the expected error.'
37- ) ;
38- assert . throws (
39- function ( ) {
40- crypto . getDiffieHellman ( 'modp1' ) . setPrivateKey ( '' ) ;
41- } ,
42- new RegExp ( '^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' +
43- 'setPrivateKey is not a function$' ) ,
44- 'crypto.getDiffieHellman(\'modp1\').setPrivateKey(\'\') ' +
45- 'failed to throw the expected error.'
46- ) ;
47- assert . throws (
48- function ( ) {
49- crypto . getDiffieHellman ( 'modp1' ) . setPublicKey ( '' ) ;
50- } ,
51- new RegExp ( '^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' +
52- 'setPublicKey is not a function$' ) ,
53- 'crypto.getDiffieHellman(\'modp1\').setPublicKey(\'\') ' +
54- 'failed to throw the expected error.'
55- ) ;
56-
5730const hashes = {
5831 modp1 : '630e9acd2cc63f7e80d8507624ba60ac0757201a' ,
5932 modp2 : '18f7aa964484137f57bca64b21917a385b6a0b60' ,
You can’t perform that action at this time.
0 commit comments