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

Actually, the author just replied to me. The problem is an API error in Crypt::DH::GMP, which he is going to fix.
  • Comment on Re^2: Usage problem with Crypt::DH::GMP::priv_key( )

Replies are listed 'Best First'.
Re^3: Usage problem with Crypt::DH::GMP::priv_key( )
by Llew_Llaw_Gyffes (Scribe) on Mar 08, 2016 at 14:54 UTC

    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.