Awesome
Test Diffie-Hellman Parameters
In need of testing a Diffie-Hellman implementation? Not sure the parameters are correct?
This test will check for
-
decent bitsize of the modulus (>=2048bits)
-
safe primes (modulus has to be of the form
2q + 1
withq
prime)
How to run it?
Using OSX?
If you are on OSX you can use directly test_DHparams
:
cat socat_dh1024_p | ./test_DHparams
Else?
-
get golang
-
get dependencies:
go get github.com/fatih/color
- examples:
-
echo "52104230423" | go run ./test_DHparams.go
-
cat socat_dh1024_p | go run ./test_DHparams.go
My input is not a hexstring nor a int
C array
In this case, example the socat one:
static unsigned char dh1024_p[] = {
0xCC,0x17,0xF2,0xDC,0x96,0xDF,0x59,0xA4,0x46,0xC5,0x3E,0x0E,
0xB8,0x26,0x55,0x0C,0xE3,0x88,0xC1,0xCE,0xA7,0xBC,0xB3,0xBF,
0x16,0x94,0xD8,0xA9,0x45,0xA2,0xCE,0xA9,0x5B,0x22,0x25,0x5F,
0x92,0x59,0x94,0x1C,0x22,0xBF,0xCB,0xC8,0xC8,0x57,0xCB,0xBF,
0xBC,0x0E,0xE8,0x40,0xF9,0x87,0x03,0xBF,0x60,0x9B,0x08,0xC6,
0x8E,0x99,0xC6,0x05,0xFC,0x00,0xD6,0x6D,0x90,0xA8,0xF5,0xF8,
0xD3,0x8D,0x43,0xC8,0x8F,0x7A,0xBD,0xBB,0x28,0xAC,0x04,0x69,
0x4A,0x0B,0x86,0x73,0x37,0xF0,0x6D,0x4F,0x04,0xF6,0xF5,0xAF,
0xBF,0xAB,0x8E,0xCE,0x75,0x53,0x4D,0x7F,0x7D,0x17,0x78,0x0E,
0x12,0x46,0x4A,0xAF,0x95,0x99,0xEF,0xBC,0xA6,0xC5,0x41,0x77,
0x43,0x7A,0xB9,0xEC,0x8E,0x07,0x3C,0x6D
just use the script c/search_for_array.sh file
to get a clean input, then pipe it to c/c_array_to_hexstring.sh
to get a hexstring that you can pipe to test_DHparams