diff --git a/tests/test_hsslms.py b/tests/test_hsslms.py index 277abb2..563dc1e 100644 --- a/tests/test_hsslms.py +++ b/tests/test_hsslms.py @@ -802,6 +802,159 @@ def testVerifyCryptechLMS5LMOTS3(self): self.assertFalse(pub.verify(msg, mangle(sigbuffer))) self.assertFalse(pub.verify(mangle(msg), sigbuffer)) + def testVerifyBouncyCastle(self): + msg = fromHex('54657374696e67') + pubbuffer = fromHex('000000010000000500000002' + \ + '4ef83a81f3197dcbd75e398b0594f335ace350fbd5cbff78552dd1ac1293c27b' + \ + 'fc4e64365d65d88aeea3d64cb9cd4f42') + sigbuffer = fromHex('000000000000000000000002d8217e20cdf4b3979f1a' + \ + '1f263a9b0a2d0a9f23aa2c3f605edc817a7077a3a977afdc80ba76094d257395' + \ + '5ce679a04b86fc98842e7bae5714864876e59919e7edff1445520feb31d963e4' + \ + '6c2f7a83f456e1ad7c9dbd1ef60e96bbd82fd6d82da839965da704e9ac617b33' + \ + 'e967c5354ec532d9b974a699b59120b14832099b6cfc8a33a9fbacd84303075e' + \ + 'a05fc27ddc0f19c3fc0353094443b6a73cfd9c6c9a728f3c9388c374ee6a1c4b' + \ + '3867cd91cdea2477d37d472b22c33a5d8d1e3231c309ac30c3bb2a5f5ae40ffd' + \ + '52905532a7eedd506b1836290a1358289bf2f9b1ef3ab691dfc702caaeef7215' + \ + '1a280ea3fe7e1e62e0e4bf4eba7b6c9e5e8f52bd04ef8d09beacd8511a432e8b' + \ + '26257d4be04d89d82550cbf429631b83ede1b98bb2780c28c0dddaa22b742a4e' + \ + '0eabffc5df90344f38376e1c412cb5de717d9ae9c3ee5c5af1e3b883ed4e5cd6' + \ + '5369bd28b4d6985c6d15159ed1bc925c367700625a04be797595f00e75348863' + \ + '9fb9b0d719aaa7fcd06d6aa29232ad5026eb2840b35ab12a6160ea04dfb42c79' + \ + '564a00d3045de779c2a27af9c1e1b8a90fc5c839e419a531ae063d4b69269afc' + \ + '8a27c90194944847b772b3ea540b738925146cddb6fe9a2600d3064d42ee1dad' + \ + '7a5cef82b85f66fd1312f860ac4ffac98a63f0f36273cecdc2fd794a113da102' + \ + '87ad27048727c2cc75953d1a68ed8408d2594c337013c0f4a75309b2d601a0fa' + \ + '75e894e216c1d20a8e9f2008a049fcbaece7c976d9b63e322cef897c325fdc05' + \ + 'b8355e791ca0741f04a5f63da0d19311933b9beb1693c65642f67c742def23d9' + \ + '3d4931147948f819e3238a2ff463beca736fe7bcb110bf4b8eb2a20bcb697109' + \ + 'd3a668e0b1c9256b934efffa8365c4e9960d7dd44fa765e083e755ebec6e6d09' + \ + '3759e0e8f8828aeff120a1e99bd54ef0b8a06b0382e6185a7a38094c97cecdf3' + \ + '59ac4e9318f40fe75bd450f44bbdaac5f83efa527aca7e653d2e5806becbb00c' + \ + '6151dbcaf98443e6291c2206b267b0ba0fb43de2fac14ae02f6b1f9e3ced461c' + \ + 'b7514a232668ab42c65a8c3201713c23d21d7d1c10e9368d0a67965462d85128' + \ + '22f7f06e4eda9a289e3e4b7db55598d2e115e172f7de8f7f24f4375c9677e19f' + \ + '75b9803a8f8497ac7e881052f4df8ab7af9b45afcf24a90603a934b049cbc42f' + \ + 'b9a3e1366802973ceae880186ad9931382fed38a2929d2a645f378fa1d6b86d1' + \ + '73ffdda074965fe2e1877f12a6ff0b1a7390926e75169af6dae7d3f26ec9d428' + \ + '697fc13b976f5e7a722f413ac8502803bb11e632b1c72da81d4a76423d76bf3b' + \ + '4bd8e54a3cb4ad10a76b553fb71051b77f29e5aa050997129139a03d5a1a9a93' + \ + 'b47fdee344c30f56c5072d2330c62146bdddbc5bd7a25f0684ed95fc6deebfab' + \ + 'e97af348897aece35f75b80060350fffab7e854786cae66d31d73b284e14853f' + \ + '27fae9483d8d2e0e59e635f41a403dde970efdeb9a31380f3e9855f715d08349' + \ + '06c86aa38ea757b97df4ac373f5d90151fde98f5a6aaddc54b3bbc11e3168dd7' + \ + 'cbeeb07ea0dcd6624ec890c7f8ed4be9be106fdca96493ad90f4c95a622640cf' + \ + 'b7a414aa2278c42b5e5ee6a1c38785c9db8d94dacfdc6b4793831b344853c0e6' + \ + '9ac2d77e33a323261bbf535ed3bc7830825ada5255b7e59e606bf58ad06799fc' + \ + '54836b0f411fc138aae0218db73cacae78fca15ccc79dffe38d1a8d08eb26496' + \ + '83d6b3bde49a4d4f34176b11577ddf0322c3d535a418c203b8defeb56750fcf6' + \ + 'b9bff53550ac7c825716bda92fae1d1cc19cb096b97c267eca8d8b3ccd18324e' + \ + '00f67979d4c3c177cccda4109de9e7d9cf7fee60e550519c9bcb44aff282bd3f' + \ + '063928b7f9d86e3c0d58099fddd87d913a4350178bf807c383a3ed18ed3d3d3f' + \ + '5354eb2a0c36c71f0555467c1471fdef9569783a7ab8e0f593ded0d876caa1ef' + \ + 'a9940d71933e41ebdf4d4e575904c1ddce0b7dcd2ecda9efcb572443039983ea' + \ + '2b394ab67264275656fe702c7a993af614add08e61970d1730af49daf882517b' + \ + '8ed9247f78cbb67ca171877fab25c2af085b679cfeac8427f810ffd71427596e' + \ + 'c209d7231c3964b05461deb52e805a5540da985d11fe28f1bf606150ec993e29' + \ + 'dd5baafcc3734f1e0a52d67dd4ae68b6247024ef5ac41e20b5ce53fca5ab344e' + \ + 'fc860327db82a1a18cd13055c7bfe077cc342ae6ec81b9eea123934d3511ce46' + \ + '83b9c6020517780c8ee3f5c5fb67aff15ec03ced617dbfbe1bf8b0e67ff3b4b8' + \ + '2fb710ad5a88ab041cc34f4da5b667f67d683415ffb4d7bf35ec99c9a7e2c51b' + \ + 'ebb34767049089e1318b8a5b7b3cd1456da350c8a230b901c0644d608d7f6d14' + \ + 'dd18c4c0e755f8d8a79b6d411f174f07cf0d91d109172818bc7d0ecd75fc44d3' + \ + 'f72e7a081abad2edf6c3bd0dc506abd539cfa83dddc9f0aba8d701db56b417d9' + \ + 'f3b1c9c3805228504dcf021b2644b06517cb136a66935c7b0913d159f327e6c4' + \ + '54d17594fc8d8aadb3007e9fc5fc4f4aa2022e3e240bfaf8d1fc7ff30f1454a2' + \ + '8929d87ece48079ba5f4cdc26e1a0234a8fc4c39416ca3a66a7c4be70acd07ba' + \ + '283d9bb5f32faa908423b0b119aebc9df31c1a037dec4f595e932e06894306be' + \ + 'bea8f577225edb6ab199000f7b19c01ecc67f88593b849d977e587394b37f6af' + \ + '9de3a838c4fa3e8cbc9b429b5620816d8e9311439f32430985b57b9534d07d7c' + \ + 'e11e40da08ee083139aacc9888b68f3e62788d1b042839c083928551f46ff51a' + \ + '3dfd399c0945de6c230817109289424556600f289131cbd238db53631ae3eba2' + \ + '1ff00db0e2a3d0afe3dc2450064c192fd21ad06cd325ae3f6bb0343a754a84a4' + \ + '25b3780bf0237406151a73800faed251707546f0d521334e2607dc15525129d4' + \ + 'cd3053d3e293c380fb38ee2971c1d32ffd8024848ddf463f98628a4300ec8120' + \ + '97575146f0a2157a53811ee8e6dccbf06185813d10ebd5fe2aa4c14dadabdafa' + \ + '7ed322ca9c47b1505867c4e3c7b80edb6378b811340222fd8f977fb0b676f0a1' + \ + '048445dba2375ac7073f873109cbcc2971c3bdafef262fb7e06d6a679bb8a77b' + \ + '1af0846fbb3fb3b3e73c68f097cb53e673c40d9e7881322b10ccfa609e0df885' + \ + '63d714dbf8f2fa735bda752b027fa24f2d289b34925675b23600a9f6f4a9bff8' + \ + '746deb48d084b8638dae616d138d38df8f9395e6b9c9965f76e39efd7ca00c54' + \ + '150dc10f5e30901788163ad163be59438415ef2e179e7381cd176c9b2bc0a127' + \ + '3770495161f3b6d23c9c833e0f6c8088ec4ec5ece0a6b62b5472d3a6d62b0a8d' + \ + 'b8ba546782fc29cf3f0b91838ee564f35031c6e312c08c12abcc4e5d64905880' + \ + 'b4d59a52d79113b7360df77cb26325c261aeb87708cdfdbbeb997940d8e3329e' + \ + 'a8c198ed4feeb05e0691023470f5daac60155940992a82a1e6217812be3966c2' + \ + '686538201883c87ff80b9ae4630829c26c3399dd13e0d24259745398114028e9' + \ + '1be723feedc04a7752c3ddc5e8464a1ccdc5e85fb2186b4bd2bfd7f1afb9ab93' + \ + 'b491d9f93f72f57624e21a4ba67cfa5b037f732b22ab5d506c54650c1091cd5a' + \ + '52a52e039519ca3decd6a07a6e4f3c7c2dd3d941efd3ba657400ac0b4905f2c0' + \ + '6014980cac4cd57ff14fc33dcb210458b7aaec62b466d4fb0c67e74f35914e19' + \ + 'f839a9a7ce3b62f7d8a669a4355cf4c791ad31c535ec993df4cef92af6f555bf' + \ + '3c4b206f7474bb1048d831ebaf50e0c203ef432832a0aea3d6b46d87a5aa07f1' + \ + 'f13a04bd502fe0ce222b95cebbbcf3b8fa5efd52b76d2e139a8e47aa298d3a12' + \ + '70002301dd95d9075b112851903150233a1ea8de4496bfd0d0a6bc0a2d1997e9' + \ + '6196f8966c5f500bce817b481852e16a04dcc0126cedd96f4acf2e5568378582' + \ + '474cdb9d4e3dc9d32bcf83c35785da2d44f96dd0e10bebb1138476208e3d8ecd' + \ + '7f95607b36a927dc4ab5002ea98d5607f193dfe9e16f85a4ac778318ac3f415a' + \ + 'cf9e3b3a9fabc77742062c94e0ab6528ceb75d18f38426c2e80ceceff6721118' + \ + '17fec4d34097685c44b9270b0cf2c0b5dbea2b82fdb68b42002daaeda50c1d88' + \ + 'caaaee74ba62718102c1cbe8e169c5c5a7e74cefadbc630323481a24c705a4eb' + \ + '535c4147fa22294f2e6c4ee3856616c10ba0c8f7488e47b68713aa04941c640d' + \ + '258a0d8be934837076dabbec404b71f7dd28b70991e20cc3e6baa640668dbc9d' + \ + '3862da9506d0ab4599d8070e023433d0ebe525fd692ce133ad83fd476d9337b4' + \ + 'e5851acbc9a93e3ddd8467429285feea625f02edd65f12b6d4be69fbf953dc08' + \ + 'cdc6a719db84b8c3ec1a210cd525f6731a54bd67e272b2cac72faa6e59f0bd75' + \ + 'b723143ee6314b2c1cf3137dbb66f56b411b41a0eee7efb0f1a2133c67ac65ac' + \ + '228bf684a948e00b09eabca1c1902d042690c1fec3666f79c79b245a505070c8' + \ + '25d2551e4dea555010903675ae84206da5b175ca7b7af95f11daa1c68b38923b' + \ + '3c9ae64d43f3ff6f2a1ee3634f8cdc18360eb0dd5a4789ed69b1d6967c4317e9' + \ + '05123c80288ad51b79b28a689b7439d1969ca89673c098e3a63ebf75d02abb38' + \ + 'ee9db6505d956a2aaf9df8dbffae996ecb296efc0cd0bb255f05cd8f760ff166' + \ + 'fa0c951c40b9151b11f3b90ab114353a1fad189b22e80b9620a8753414cbdb92' + \ + '937665952b08a4228a941f05eaa73eae51c4f64101ab26f8c591f31ee3790c2d' + \ + 'e74c30f53c7c900b5624a092e3349a8556cf401b28d23c54454d4102ec085a8f' + \ + '199e97e09fda850dca3ef0004401cd74bbd7028840c658dd44a6988a41b958a2' + \ + '9d005c383fefcd1b7baec3d936580abfc683411f3c042658f0e12da7e0a48dfb' + \ + '60a2c99c3e68a53f22b81acf3263ac4ba0f2873d1fc1fd5b2bac330ad65c2109' + \ + 'b7e800a63981f8e6ca65eeb8dbf87e581c7f085f10592a8d4ff66a0515826ab0' + \ + 'fc28654d52f45da46e959b8590ce769d5ef0db88762ae394b415b6271f25f269' + \ + 'c11d4f90bf8c87feb7caa609795a787319ac09f6c17823c38111644e793b8470' + \ + 'e2ca5ebcc7a0f53cd2a14f0800c132fd66b41a55eeda396de4f4a07725a6d47f' + \ + 'a2c2969fc9d52166863aae48d30be4a4131ada20a9591ca4621b45c96efb4f8d' + \ + '836a88f06fec5b05979d37ef273827a976f5454159c3fd71a52a6809821c8688' + \ + '2ddc2171ae428ed45934e661dae81faad6d3da8e3e4c1fbc097f2e3c8ee026a6' + \ + 'c324c4a179b9a61570592401dc7091485166613bb73465600ffb6dac16317bc2' + \ + 'a216bb2d5f1dd958ebbdcf728a86e79066b606c9231725669c69760a6684081c' + \ + 'fcbd89350b87475fba236dc3cb002a90cbbce100f324503ca690595ae669b0ce' + \ + '18edeaaa987d5a54b7e99992e8ff7bce09ebc23d1a2a4e9954dd3f8a05c89a79' + \ + '2c4374b7759f4cf35c7c18d3906f9cf3197488749b2682549a97cb8601bf51c8' + \ + '499e10e83869af0262570078bc59028e9256c95ba78c42827d6479b5f1b77eb7' + \ + '5fcb9d4c0c5114ef6133e50fb444da14350259a72d37d760328930ecc6825d9f' + \ + '054f0bb110966b892d7840475be34410802bb05cee1dcb4d7c0554c1b3724aa0' + \ + 'ed079341570fceb29d7f99b5571a5b26032d184d5dee04cb862f4b3780699f91' + \ + 'd4ce3cc4fc1dc61d17f01dbcfc0b14e9b4245a3e2ce97796ff34dfd2b0c6d31f' + \ + '2fb91dbc985d408a9614f6e18872f17b553416e662566c1e0edc5da2b93554f3' + \ + '448ae0b2ee07240fc11d2794e39ff6c1a25b3dd66415a89781566498f26d690a' + \ + '9d59b29355134f646bf2a6e2923017fb0a4034fcbb92af06435482b8ecda3743' + \ + '2122415c9b568bb6627bb99c71c6e72e49df9485293606c895375558564e248e' + \ + 'e57bf3b4d8224b886c39ea08503e79978f2fe99cf3d8ed25f8b15bbb411c0ffe' + \ + 'f2219c5f64b5e8ff65fbe7f5149c9a011aa4a47d07a644ee83e000f4bb0f179c' + \ + 'df1ee5b5b67c8895d0124500baae4770089d8f9603f67fd73a04e05e9ff4cfad' + \ + '785976dd6dd575da50f9e44f1570903c6152da8ab0a6cbbef351394fa797148f' + \ + '72ab65019ecd4b5ec2c312f805b82522c61cf169ae0d00000005775f2a16b768' + \ + '321031dd84511c09394c1c6b883048fa6cd31e1cbe9b854647995efa572c9473' + \ + '5b79569ec0a526ed9c41f292c84d2890e6080c36e9d79b9fc32164c62ea576a7' + \ + '2a5db7fccdbeceda27f8daf670868a767f0679eb1f123cfb8dd378a93d31d2d0' + \ + '998d3cf0115cdd1d5eadb4f9a1e9c83c002213e7ada51033f475bf20afd7dceb' + \ + '018861b0ab6aaed9598195aee500f79f7447fbf8e3483134699b') + pub = pyhsslms.HssPublicKey.deserialize(pubbuffer) + self.assertTrue(pub.prettyPrint()) + sig = pyhsslms.HssSignature.deserialize(sigbuffer) + self.assertTrue(sig.prettyPrint()) + self.assertTrue(pub.verify(msg, sigbuffer)) + self.assertFalse(pub.verify(msg, mangle(sigbuffer))) + self.assertFalse(pub.verify(msg[1:], sigbuffer)) + def testVerifyRFCExample(self): msg = fromHex('54686520706f77657273206e6f742064656c656761' + \ '74656420746f2074686520556e69746564205374617465732062792074686520' + \