| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 928aecc commit fb553b5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,42 @@ const certPem = fixtures.readSync('test_cert.pem', 'ascii'); | |||
| 15 | 15 | const keyPem = fixtures.readSync('test_key.pem', 'ascii'); | |
| 16 | 16 | const modSize = 1024; | |
| 17 | 17 | ||
| 18 | + { | ||
| 19 | + const Sign = crypto.Sign; | ||
| 20 | + const instance = Sign('SHA256'); | ||
| 21 | + assert(instance instanceof Sign, 'Sign is expected to return a new ' + | ||
| 22 | + 'instance when called without `new`'); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + { | ||
| 26 | + const Verify = crypto.Verify; | ||
| 27 | + const instance = Verify('SHA256'); | ||
| 28 | + assert(instance instanceof Verify, 'Verify is expected to return a new ' + | ||
| 29 | + 'instance when called without `new`'); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + common.expectsError( | ||
| 33 | + () => crypto.createVerify('SHA256').verify({ | ||
| 34 | + key: certPem, | ||
| 35 | + padding: undefined, | ||
| 36 | + }, ''), | ||
| 37 | + { | ||
| 38 | + code: 'ERR_INVALID_OPT_VALUE', | ||
| 39 | + type: Error, | ||
| 40 | + message: 'The value "undefined" is invalid for option "padding"' | ||
| 41 | + }); | ||
| 42 | + | ||
| 43 | + common.expectsError( | ||
| 44 | + () => crypto.createVerify('SHA256').verify({ | ||
| 45 | + key: certPem, | ||
| 46 | + saltLength: undefined, | ||
| 47 | + }, ''), | ||
| 48 | + { | ||
| 49 | + code: 'ERR_INVALID_OPT_VALUE', | ||
| 50 | + type: Error, | ||
| 51 | + message: 'The value "undefined" is invalid for option "saltLength"' | ||
| 52 | + }); | ||
| 53 | + | ||
| 18 | 54 | // Test signing and verifying | |
| 19 | 55 | { | |
| 20 | 56 | const s1 = crypto.createSign('SHA1') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments