crypto: allow undefined for saltLength and padding · nodejs/node@c35acc0 (original) (raw)

`@@ -32,23 +32,23 @@ const modSize = 1024;

`

32

32

`common.expectsError(

`

33

33

`() => crypto.createVerify('SHA256').verify({

`

34

34

`key: certPem,

`

35

``

`-

padding: undefined,

`

``

35

`+

padding: null,

`

36

36

`}, ''),

`

37

37

`{

`

38

38

`code: 'ERR_INVALID_OPT_VALUE',

`

39

39

`type: TypeError,

`

40

``

`-

message: 'The value "undefined" is invalid for option "padding"'

`

``

40

`+

message: 'The value "null" is invalid for option "padding"'

`

41

41

`});

`

42

42

``

43

43

`common.expectsError(

`

44

44

`() => crypto.createVerify('SHA256').verify({

`

45

45

`key: certPem,

`

46

``

`-

saltLength: undefined,

`

``

46

`+

saltLength: null,

`

47

47

`}, ''),

`

48

48

`{

`

49

49

`code: 'ERR_INVALID_OPT_VALUE',

`

50

50

`type: TypeError,

`

51

``

`-

message: 'The value "undefined" is invalid for option "saltLength"'

`

``

51

`+

message: 'The value "null" is invalid for option "saltLength"'

`

52

52

`});

`

53

53

``

54

54

`// Test signing and verifying

`

`@@ -233,7 +233,7 @@ common.expectsError(

`

233

233

``

234

234

`` // Test exceptions for invalid padding and saltLength values

``

235

235

`{

`

236

``

`-

[null, undefined, NaN, 'boom', {}, [], true, false]

`

``

236

`+

[null, NaN, 'boom', {}, [], true, false]

`

237

237

`.forEach((invalidValue) => {

`

238

238

`common.expectsError(() => {

`

239

239

`crypto.createSign('SHA256')

`