in reply to Re^2: Usage problem with Crypt::DH::GMP::priv_key( )
in thread Usage problem with Crypt::DH::GMP::priv_key( )

Immediate fix:

While priv_key() in Crypt::DH::GMP does not work as a setter (but is supposed to; that's the bug), priv_key can be set in the constructor. So changing:

$DH = Crypt::DH::GMP->new; $DH->g($g); $DH->p($p); $DH->priv_key($DH_private); $DH->generate_keys;

to:

$DH = Crypt::DH::GMP->new(p => $p, g => $g, priv_key => $DH_private); $DH->generate_keys;

...solves the problem, and is tidier code anyway.