On Fri, Jan 23, 2004 at 06:57:19PM +0100, Renzo Tomaselli wrote: > Hi all, > I'm trying to implement an ESDH key agreement by means of DigitalNet > S/MIME Freeware Library, which uses Crypto++ as an optional underlying > cryptographic provider (CTIL component). > I'm actually blocked within low-level DH math details, in > DL_GroupParameters_IntegerBased::ValidateElement (gfpcrypt.cpp). > Basically, the test "g < p" fails, since g (the recipient public key), is > 1024 bits long while the modulus p is 184 bits. They come from a DH > certificate I built from CertificateBuilder.
With DH, g has to be less than p, so either there's something wrong with the certificate, or you're not parsing it correctly. Maybe what you're interpreting as p is actually the private key. That would make more sense, because a 184 bit p would be totally insecure, whereas 184 bit private key is ok. > Also I see in DL_GroupParameters_IntegerBased::DecodeElement that it's > assumed for the public key to be the same byte count as the modulus. This > could lead the above test to wrong conclusions if they have different > length. The DH code in Crypto++ always pads the public elements to the same length as the modulus.
