mirror of
https://github.com/vacp2p/nim-libp2p-experimental.git
synced 2025-01-27 10:35:10 +00:00
new tests
This commit is contained in:
parent
d717a267d0
commit
d1b1751635
@ -251,24 +251,20 @@ suite "Peer testing suite":
|
||||
|
||||
test "spec test vectors":
|
||||
# from https://github.com/libp2p/specs/pull/537
|
||||
const privateKeys = [
|
||||
#TODO fails
|
||||
#"08031220F0D87659B402F0D47589E7670CA0954036F87B2FBF11FAFBC66F4DE7C3EB10A2",
|
||||
"080112407E0830617C4A7DE83925DFB2694556B12936C477A0E1FEB2E148EC9DA60FEE7D1ED1E8FAE2C4A144B8BE8FD4B47BF3D3B34B871C3CACF6010F0E42D474FCE27E",
|
||||
#TODO fails
|
||||
#"080012C81230820944020100300D06092A864886F70D01010105000482092E3082092A02010002820201009C897F33E0D0B3297F2FE404EA5B7A98096B329693292AEFC2D05EF1E82FD0E121CE74EC77D75EF4B532FA34DEE2A19626F3389C6D2BB9B8DE614E138302BC4254727A7EE35F7827F1094403BC2FE8E1F64D0E8A2A77E8F3A879F69F94A71F3589DE184F5910D6B5270F58E684F71DDD3A3F486A4CB2C390194EE6E9B65F9F1DFF7B8F6C0BF4E0C4AC683BD4BA2D2FD022FDAAA3DB75E90E16662FC4B3ACA4C9AA65514D51690CD372C2B96C61A1ED4F9298EC213D5398AA9120379477118391104DEB77AB157A59B70714E95CAA9B55D15FA386B0C80F36E50D738BDD10E0BAA3C3EAFB4703DEC3D6A757601F18541EB87AE9111F60EAE17D843CF1047DBF5A8982AD9EF0AA88F59B17689F1210A305F7DA8A012C1A58E4E82B48811618E98CEF13C9EB28CE6FCC589EA5D902149EE4F49F8B39758B349CA90BE5A8BDDF4A46BACAAA48AEC1C0C6E996AB13F2CB351C351D40B0A7B8E0C12B366A8555C392B0AADF71FE746EB4F8EA0B829DA6DDCC39081ABDD40EA2F3D8778B9A3F06A480EF34234975E919C0D64D818F2E904A9F251C8669DBB1666CB2C28E955446FC7EFD460D4677ED922CCFF1E24BB5A8699E050075C7897A64DAA1BC2F05E4132E76C4F72BAEA5D073042254236C116EA3E40540BB7986468B4468AADFADAD068331EF9DBE13E4012196E8EB9F8CDBA096C35F09E80893EA68F3253DC41053983855E50203010001028202002699DD6D4C960A68443DEA0BB04308B32F37690D2A92EF4C9A8CC9ACFBA5B6EB9D6B8CF7B701BC1FBA032D2216886A725D7E82CA483D8D19E274BA4D23746C3A2B1AE3CC2083AD5CA41AB5D3F9F712858E38284AB7F843D0BA0E015C0ECB3B6DF766763632EF6D12D4E3FAF73578BEBB8C1E88DBF5B7EB73C059EDA55A5CB01F349E229AF143DC9D832A5CFEB33E6B58F717F8995987F5058D4E7B9F14F390DB4E1297FEEA016EB141CE74ED1E125133DB21ACB0F1AF88A91F0A83CA2FA678FC2FBA1743B643A09D38FE1D1102D1EB6639304D61EC7C190C5F6576C5D9A8CCD2198A398AE75333FEB51324FFC60B38CB2E90D8A2694B7C0048F47016BB15CB36C482E038E455254E35FC4F0E0BABC84E046BD441B0291412C784E4E9639664CAD07CB09A01626049CDBFD1D9AD75B314448DF811F4988C6E64D93EBEFC602B574D0763E31E9D567C891349CFE75F0CA37429B743D6452D1FFFC1F9F4901E5F68772B4F24542D654FD29B893E44C85E6037BBA304D48873721131F18248B16BD71384ABD00F9336C73F071A4CA2456878070F9704ED7DF0CD64E5C3E5949A78968525865B96E71D5015DC68BFF857F2BBA05A3976D83D8866D4DFE8CAAC144741AE97879A765DC0D4C7C34AA79EF6EBC86B5BF32B50AD995780F5F1A6C052EEC5671164F407061A9C6BD49251B1BB7803BB222F5D859C321601236DD893DC9D810282010100CF13FE9908FE59E947122D5606CF9F70C123B7CB43A1916463E729F01DC31C3B70CB6A37BDE542ECDC6029CEA39B28C99C6395D0AAA29C1C4CF14B3FED9E0FCD793E31B7A09930352261C03B3DC0B66A62F8AE3771B705382CFEB6130D4A7E5B4854117A05767B99915099E2D542FC3FA505A0DBE217B169B46714384774380408BD8B3DBF0C9A177BBD3E64AF115988159F485D70C885171007646765B50EB9BBEBFABE60E71C69B2B822A124E235AD05F2B55CDA9DDC78D671436981A3064A80C29BB37E6B5581A9372A6366C79AF695A39EA0F3839ED77EC3985252F2E126955774727955B63CCBEFF64208FD7280E8BA52E4297CB6BF72B44B07618923610282010100C184CD27D3A643DF768764A7C66DE40C222BDB4B7E02C35AA1E4A8377676247C629DF58ECB5BB541FB4AAC1BDE35057B0B266BDDD818876909B8FFF1ACA4859515069258D84B0C5178E4BFF6842C68D39CAD9A3A03AA6533FA76B92C995F381EB9C83F5E6118FD962807C931B7CA50DC20B261F2A71928F3E882AF4DA979CEF843970CB2AF68B86477B92CA90C8C0F1D640D39E943704366314C446F7A54851419E60F4E92E1E69BD52EE7294F9EDDC6DC873144B0D0D9F13EB8D6AA955CF11EDBD5A0673D8B70EF937E54FDAADE185FACC8437496D43A53169342280718A3679170EF4A0E582AF4DB598210FB64616F0D8DAA08519D875E37C4D02E1AF1C5050282010100C14865648C3B74CAC3B698B06A4D130218947131FD9F69E8ED42D0273A706A02A546888F1CE547F173C52260A8DEE354436FC45F6F55B626C83E94C147D637E3CEDE1963CF380D021B64681C2388A3FB6B03B9013157E63C47EB3B214F4F8FDF3E04920775DFE080375DA7354D5F67B9341BABC87121324C7AC197E2EBF6F36DF8868AD8086207D6117E5325812ECD85B2C0E8B7A6D4D33CF28E23CE4AE593A8135AB0C1500B87BEB4BD203D8F02C19D0D273CD73D8B094594CB4563CE47CF506D1CB85DF28AD6D5DE8F0A369BB185D7D1565672DEB8A4E37983B1C26D801C5D7A19962C5F4A7C7E04D0A6E77E22AAE4DDD54417890DCA39AA23D4C03FEED4210282010100915975DE1C121D9892264F6BD496655AD7AFA91EA29EE0AC0A3CFC3BEC3600618C90A80780A67915FDF0B0249E59A4AC2E4BC568F30E3966A36ED88E64E58D8FD4230378C7BC569C3AF955558B20EFFB410B0373DF9CF4367E40FE04898E0350D0A99F2EFC2F1108DF3839DDA5F5C7960ED8ECC89CC9410131FA364156B1AECAB9B992480387DC3759D533BE25366D83DDCA315D0AD21F4D7A69965D44BC86D7FA3BD9F3624F5A2E6188C1073E4E4CB5389E325B2D93309F0A453AB71548A1B253DBB886D2AB114060BFDA864CF853C648B88231E7B7AFB70895C272DE219B5A06DB945F4336E5CCD393FF25522CAB220644091A06731361A8F1A28B7EA169210282010100BD80196D3D11A8257B5F439776388F4D53E4DA3690F710E9AFF3E3E970E545EC92D285E7049DA000D5364DD7F550C17CF662D516282FE89813CAB322CE5AAD5CC744C52A024DD1A94AA9484037281637D1C8E3503B6ED6231225C93F7865D29269C899BBF5D248CF9D41F9AEE9B9CB2AFAC172BA17C2DF0699C6604B4CE7AB95C91C5F7FC7804F2BDE268A7E15C512920F7325CFBA47463DA1C201549FC44C2BC4FBE5D8619CDE9733470C5E38B996F5C3633C6311AF88663CE4D2D0DC415AC5C8258E1AA7659F9F35D4B90B7B9A5A888867D75636E6443CCE5391C57D48D56409029EDEF53E1A5130EB1FA708758BC821E15F7C53EDF6D4C6F868A6B5B0C1E6",
|
||||
"080212201E4F6A12B43BEC6871976295BCB13AACE62A7E7B821334125D3ED3B720AF419F"]
|
||||
|
||||
const publicKeys = [
|
||||
#"0803125B3059301306072A8648CE3D020106082A8648CE3D03010703420004DE6AF15D8BC9B7F7C6EB8B32888D0DA721D33F16AF062306BAFC64CDAD741240CD61D6D9884C4899308EA25513A5CC03495FF88200DC7AE8E603CEB6698D2FEE",
|
||||
"080112201ED1E8FAE2C4A144B8BE8FD4B47BF3D3B34B871C3CACF6010F0E42D474FCE27E",
|
||||
#"080012A60430820222300D06092A864886F70D01010105000382020F003082020A02820201009C897F33E0D0B3297F2FE404EA5B7A98096B329693292AEFC2D05EF1E82FD0E121CE74EC77D75EF4B532FA34DEE2A19626F3389C6D2BB9B8DE614E138302BC4254727A7EE35F7827F1094403BC2FE8E1F64D0E8A2A77E8F3A879F69F94A71F3589DE184F5910D6B5270F58E684F71DDD3A3F486A4CB2C390194EE6E9B65F9F1DFF7B8F6C0BF4E0C4AC683BD4BA2D2FD022FDAAA3DB75E90E16662FC4B3ACA4C9AA65514D51690CD372C2B96C61A1ED4F9298EC213D5398AA9120379477118391104DEB77AB157A59B70714E95CAA9B55D15FA386B0C80F36E50D738BDD10E0BAA3C3EAFB4703DEC3D6A757601F18541EB87AE9111F60EAE17D843CF1047DBF5A8982AD9EF0AA88F59B17689F1210A305F7DA8A012C1A58E4E82B48811618E98CEF13C9EB28CE6FCC589EA5D902149EE4F49F8B39758B349CA90BE5A8BDDF4A46BACAAA48AEC1C0C6E996AB13F2CB351C351D40B0A7B8E0C12B366A8555C392B0AADF71FE746EB4F8EA0B829DA6DDCC39081ABDD40EA2F3D8778B9A3F06A480EF34234975E919C0D64D818F2E904A9F251C8669DBB1666CB2C28E955446FC7EFD460D4677ED922CCFF1E24BB5A8699E050075C7897A64DAA1BC2F05E4132E76C4F72BAEA5D073042254236C116EA3E40540BB7986468B4468AADFADAD068331EF9DBE13E4012196E8EB9F8CDBA096C35F09E80893EA68F3253DC41053983855E50203010001",
|
||||
"0802122102F0A81DDDE0A3180610155FF3B2D98D683A6831FAD0C84BA36CD49B81EAA7CF8F"
|
||||
const keys = [
|
||||
#TODO this one fails
|
||||
#(
|
||||
# public: "0803125b3059301306072a8648ce3d020106082a8648ce3d03010703420004ada418c4f1f7715ef1a365d9ae1e80f5d7069ab55ee19f1c4d77b44ea8dc9cbda558fe88dc32779c68573bf330daeeae1f44158a3b7d4b325230a8daf0d46dc5",
|
||||
# private: "0803128a01308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b0201010420122f33dad49e77dd1a467ac4b4b9432079d3ac0c110f9a608e86ff31a7552e55a14403420004ada418c4f1f7715ef1a365d9ae1e80f5d7069ab55ee19f1c4d77b44ea8dc9cbda558fe88dc32779c68573bf330daeeae1f44158a3b7d4b325230a8daf0d46dc5",
|
||||
#),
|
||||
(
|
||||
public: "080112201ed1e8fae2c4a144b8be8fd4b47bf3d3b34b871c3cacf6010f0e42d474fce27e",
|
||||
private: "080112407e0830617c4a7de83925dfb2694556b12936c477a0e1feb2e148ec9da60fee7d1ed1e8fae2c4a144b8be8fd4b47bf3d3b34b871c3cacf6010f0e42d474fce27e",
|
||||
)
|
||||
]
|
||||
|
||||
for index, pkStr in privateKeys:
|
||||
echo PrivateKey.init(pkStr)
|
||||
for (public, private) in keys:
|
||||
let
|
||||
privateKey = PrivateKey.init(pkStr).get()
|
||||
publicKey = PublicKey.init(publicKeys[index]).get()
|
||||
privateKey = PrivateKey.init(private).get()
|
||||
publicKey = PublicKey.init(public).get()
|
||||
check: privateKey.getPublicKey().get() == publicKey
|
||||
|
Loading…
x
Reference in New Issue
Block a user