On 9/26/07, greatx <[EMAIL PROTECTED]> wrote:
>
> I need to perform ECDH.
>
> The data I am given to initialize things are in ASN1 as (I added some
> comments to it for help):
>
> SEQUENCE {
>   OBJECT IDENTIFIER ecPublicKey (1 2 840 10045 2 1)
>   SEQUENCE
>   {
>     INTEGER 1   ----->  Version=1
>     SEQUENCE
>     {
>       OBJECT IDENTIFIER prime-field (1 2 840 10045 1 1)
>       INTEGER    ----->  prime  'p'
>         00 D7 C1 34 AA 26 43 66 86 2A 18 30 25 75 D1 D7
>         87 B0 9F 07 57 97 DA 89 F5 7E C8 C0 FF
>     }
>     SEQUENCE   ------>  curve equation
>     {
>       OCTET STRING    ------->   parameter  'a'
>         68 A5 E6 2C A9 CE 6C 1C 29 98 03 A6 C1 53 0B 51
>         4E 18 2A D8 B0 04 2A 59 CA D2 9F 43
>       OCTET STRING    ------->   parameter  'b'
>         25 80 F6 3C CF E4 41 38 87 07 13 B1 A9 23 69 E3
>         3E 21 35 D2 66 DB B3 72 38 6C 40 0B
>     }
>     OCTET STRING       ------->   encoded group generator  'G'
>       04 0D 90 29 AD 2C 7E 5C F4 34 08 23 B2 A8 7D C6
>       8C 9E 4C E3 17 4C 1E 6E FD EE 12 C0 7D 58 AA 56
>       F7 72 C0 72 6F 24 C6 B8 9E 4E CD AC 24 35 4B 9E
>       99 CA A3 F6 D3 76 14 02 CD
>     INTEGER    ------->   group order  'n'
>       00 D7 C1 34 AA 26 43 66 86 2A 18 30 25 75 D0 FB
>       98 D1 16 BC 4B 6D DE BC A3 A5 A7 93 9F
>     INTEGER 1       ------->   cofactor  'f'
>   }
> }
>
>
> Once I parse these parameters and put them into "Integer", etc, how do
> I pass them into crypto++ to the ECDH object?
> Is there any way to do this by passing the entire data above without
> passing each individual piece?
>

Yes. Assuming you've got the data in a BufferedTransformation of some
sort (I have a ByteQueue here) all you need to do is

CryptoPP::ByteQueue keyQ;
// their DER-encoded subject public key info structure winds up in keyQ...
CryptoPP::DL_PublicKey_EC<CryptoPP::ECP> theirPublicKey;
theirPublicKey.BERDecode(keyQ);

HTH,

Geoff

--~--~---------~--~----~------------~-------~--~----~
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