I was doing some more digging so I could provide more info about this problem:
The OtherPublicKey is a signed positive integer without the ASN1 integer header (just the plain bytes), it starts with 0x00 because otherwise if it started with 0xB2 it would be negative. So OtherPublicKey length is 0xC1 bytes. The Prime is a signed positive integer, which is represented here WITH the ASN1 integer header: '02 81 C1' 00 D7 BC E1..... On the sample code I provided, I wrote 02 81 "C0" 00 D7.... instead of C1, because I was testing something and forgot to revert the changes... the correct is C1. Again, like in the OtherPublicKey, it needs the 00 in the begining because otherwise it would be a negative number if it stared with D7. So.... the problem is that dh.PrivateKeyLength(), dh.PublicKeyLength() and dh.AgreedValueLength() return 0xC0 as the length. Then when I call: Agree(SharedSecret, myPrivKey, OtherPublicKey, true) there is no way for me to tell Agree that the OtherPublicKey has length of 0xC1 instead of 0xC0. Agree is expecting the length of 0xC0! This does not seem to be a problem when I use the iPrime, because it is a crypto++ Integer, and therefor when I pass it to DH dh(iPrime, iGenerator) it knows that it is 0xC1 bytes long. If Agree would take as an input the Integer data type for the OtherPublicKey, then maybe this would work. Any ideas???? Thanks. Christian --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
