mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
GOST signature unit test added
This commit is contained in:
parent
7a51abc2f9
commit
13aab750dd
4 changed files with 36 additions and 5 deletions
29
tests/test-gost-sig.cpp
Normal file
29
tests/test-gost-sig.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <cassert>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../Gost.h"
|
||||
#include "../Signature.h"
|
||||
|
||||
const uint8_t example2[72] =
|
||||
{
|
||||
0xfb,0xe2,0xe5,0xf0,0xee,0xe3,0xc8,0x20,0xfb,0xea,0xfa,0xeb,0xef,0x20,0xff,0xfb,
|
||||
0xf0,0xe1,0xe0,0xf0,0xf5,0x20,0xe0,0xed,0x20,0xe8,0xec,0xe0,0xeb,0xe5,0xf0,0xf2,
|
||||
0xf1,0x20,0xff,0xf0,0xee,0xec,0x20,0xf1,0x20,0xfa,0xf2,0xfe,0xe5,0xe2,0x20,0x2c,
|
||||
0xe8,0xf6,0xf3,0xed,0xe2,0x20,0xe8,0xe6,0xee,0xe1,0xe8,0xf0,0xf2,0xd1,0x20,0x2c,
|
||||
0xe8,0xf0,0xf2,0xe5,0xe2,0x20,0xe5,0xd1
|
||||
};
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
uint8_t priv[64], pub[128], signature[128];
|
||||
i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410TC26A512, priv, pub);
|
||||
i2p::crypto::GOSTR3410_2012_512_Signer signer (i2p::crypto::eGOSTR3410TC26A512, priv);
|
||||
signer.Sign (example2, 72, signature);
|
||||
i2p::crypto::GOSTR3410_2012_512_Verifier verifier (i2p::crypto::eGOSTR3410TC26A512, pub);
|
||||
assert (verifier.Verify (example2, 72, signature));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue