AJ:

I do not know if anyone has answered you yet, but this is how I
load/unload the Crypto++ Integers for DH:

       Integer p((const unsigned char*)pParamP->Access(),
pParamP->Length());

where the 1st parameter is a "char *" to the 1st byte of the integer
(not encoded).  "p" is expected to be 128 bytes.

If you need to extract byte-oriented (removing endian issues) data like
the 1st parameter above:

   unsigned char achP[130];
   p->Encode(&achP[0], 128);

If you need to decode an incomming ASN.1 encoded integer:

    CryptoPP::ByteQueue xBTQue;
    xBTQue.Put((unsigned char *)ptr, len); // ptr is the array
containing an 
                                                        // ASN.1 encoded
Integer, starting
                                                        // with 0x02 tag
for Integer, followed
                                                        // by 0x8180,
indicating 128 bytes in
                                                        // length.
    p->BERDecode(xBTQue);

This logic works for me using the Crypto++ library and DH classes
expecting Integer parameters.  Hope it helps.

Bob Colestock

-----Original Message-----
From: AJ Harrington [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 21, 2003 10:58 AM
To: [EMAIL PROTECTED]
Subject: Encoding format of IETF primes


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey all,

Time for me to embarrass myself.  In the IETF file which specifies the
primes 
used for DH (and therefore can be used for Elgamal), how are they
encoded?  A 
better question would probably be which function do I use to initialize
an 
Integer with those values (DERDecode, BERDecode, etc)?

Thanks!

Ciao,


ajh
- -- 
AJ Harrington                                   ajharrington.net
http://www.ajharrington.net/
Public Key at http://www.keyserver.net
Key fingerprint = 0D2D 9598 659F 4901 7BBB  E126 7EDF 04DB 6EE6 87E9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE+LW32ft8E227mh+kRAg4HAJ9sVuQYJJ1f+NuHTyrwn4lbnfEDYgCeLXL1
hiF8Z/VZ1bBQktYveMbV0Lo=
=bNzW
-----END PGP SIGNATURE-----

Reply via email to