Looking for help with crypto:dh_generate_key/1

Max Lapshin <>
Thu Apr 1 20:46:59 CEST 2010

I can't understand, what do I need to pass to dh_generate_key for
generating public and private keys.

Documentation tells: dh_generate_key(DHParams)

DHParameters = [P, G]
P, G = Mpint
Where P is the shared prime number and G is the shared generator.

I'm trying

crypto:dh_generate_key([2, 137]).

** exception error: bad argument
     in function  port_control/3
        called as port_control(crypto_drv02,45,[<<0,0,0,0>>,[2,137]])
     in call from crypto:control/2
     in call from crypto:dh_generate_key/2

So, what should I pass? Just an example. Google doesn't tell anything

More information about the erlang-questions mailing list