test_dh() ->
DHParams = crypto:dh_generate_parameters(1024,2),
{ PubKey1 , PriKey1 } = crypto:generate_key(dh,DHParams),
{ PubKey2 , PriKey2 } = crypto:generate_key(dh,DHParams),
SharedKey1 = crypto:compute_key(dh,PubKey2,PriKey1,DHParams),
SharedKey2 = crypto:compute_key(dh,PubKey1,PriKey2,DHParams),
SharedKey1 =:= SharedKey2.
댓글 없음:
댓글 쓰기