Hi Vadym,

I think this explains why I could load the Group Parameters coming
from a PKCS#3 structure (was not really loaded properly) but then
Agree() would fail?

The PKCS#3 structure I am using is:
SEQUENCE
  INTEGER - Prime - p
  INTEGER - Group Generator - g
  INTEGER - Private Key Length

I was passing this to the DH class in the constructor like:
BYTE GroupParameters[] = {0x30, 0x30, 0x82, 0x01, 0x0B,...};
DH dh(StringSource(GroupParameters, GroupParametersLen, true, NULL));

This would not complain, but latter on the Agree() call would fail
returning 0.


Parsing the Prime and Generator manually and passing them in the
constructor was the solution for my problem.


Related postings are:
http://groups.google.com/group/cryptopp-users/browse_thread/thread/170154c69e526792
http://groups.google.com/group/cryptopp-users/browse_thread/thread/482358799139a6df


Thank you.
Christian


On Sep 18, 4:51 pm, Vadym Fedyukovych <[EMAIL PROTECTED]> wrote:
> It seems DL_GroupParameters_IntegerBased::BERDecode()
> would fetch generator and order from PKCS-3 -encoded parameters
> (according toftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-3.asc)
> in the reverse order.
> Namely, pkcs-3 specify generator to follow modulus,
> and order to be the last one in the sequence.
>
> Is it a good idea to keep DL_GroupParameters_IntegerBased::BERDecode()
> capable parsing pkcs-3 ?
>
> I'd put it like
>   BERSequenceDecoder parameters(bt);
>     Integer p(parameters);
>     Integer g(parameters);
>     q = (p-1)/2;
>     if (!parameters.EndReached())
>       q.BERDecode(parameters);
>     parameters.MessageEnd();
>
> Vadym Fedyukovychhttp://vf.org.ua/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to