On Thu, Sep 13, 2007 at 12:40:10PM -0700, greatx wrote:
> 
> I am given the Public Key and Domain Parameters from the other party.

It's likely that Domain Parameters are group description.
In case of a multiplicative group: modulus p, generator g, group order q.

Then, Public Key is  g^x mod p,
for some x that is a private key of the other party.

> I need to:
> -generate the ephemeral key pairs (Public Key and Private Key)

So, get some y at random from 2..(q-1)  for your Private Key
and produce g^y mod p  for Public

> -then generate the DH shared secret

That is, (g^x)^y  mod p

> Is there any source code sample using crypto++ that illustrates this?
> What functions should I use?
> 
> 
> Since I cannot attach files here, this is the given sample data in hex
> format:
> 
> Given PublicKey as a BitString (0x84 bytes long):

You need to make an integer g^x from this somehow,
so you was likely given a hint regarding encoding as well.
It might be DER/ASN.1

> 00 02 81 80 55 3C E7 35 EC F5 CB F2 02 9D 30 FA A4 F9 73 35 DF 40 40
> ...
> 
> PublicKey above after striping zeroes (0x80 bytes long):

What's the reason for doing this?

> 55 3C E7 35 EC F5 CB F2 02 9D 30 FA A4 F9 73 35 DF 40 40 47 E4 F8 58
> ...
> 
> Domain Parameters (0x10f bytes long):

This might be a DER-encoded structure.
Consider parsing it with an ASN.1 tool

> 30 82 01 0B 02 81 81 00 DC B5 54 DF 8C 69 31 E8 65 C1 B5 88 27 3D 80
> ...


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