Software / code / prosody
Comparison
spec/util_crypto_spec.lua @ 12703:5bda8598a2af
util.crypto: tests: fix some tests that didn't do much (thanks luacheck!)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 02 Jul 2022 15:27:44 +0100 |
| parent | 12700:899c057781cd |
| child | 12737:924bc1c8d0d9 |
comparison
equal
deleted
inserted
replaced
| 12702:f63176781940 | 12703:5bda8598a2af |
|---|---|
| 131 string.rep("\000", 72); | 131 string.rep("\000", 72); |
| 132 string.rep("\000", 256); | 132 string.rep("\000", 256); |
| 133 string.rep("\255", 72); | 133 string.rep("\255", 72); |
| 134 string.rep("\255", 3); | 134 string.rep("\255", 3); |
| 135 }; | 135 }; |
| 136 for _, sig in ipairs(invalid_sigs) do | 136 for _, invalid_sig in ipairs(invalid_sigs) do |
| 137 local r, s = crypto.parse_ecdsa_signature(""); | 137 local r, s = crypto.parse_ecdsa_signature(invalid_sig); |
| 138 assert.is_nil(r); | 138 assert.is_nil(r); |
| 139 assert.is_nil(s); | 139 assert.is_nil(s); |
| 140 end | 140 end |
| 141 | |
| 142 end); | 141 end); |
| 143 it("can be built", function () | 142 it("can be built", function () |
| 144 local r, s = crypto.parse_ecdsa_signature(sig); | 143 local r, s = crypto.parse_ecdsa_signature(sig); |
| 145 local rebuilt_sig = crypto.build_ecdsa_signature(r, s); | 144 local rebuilt_sig = crypto.build_ecdsa_signature(r, s); |
| 146 assert.equal(sig, rebuilt_sig); | 145 assert.equal(sig, rebuilt_sig); |