Hi Gary,

>        cout<<"PrivateKeyArray is:"<<endl;
>        HexEncoder(new FileSink(cout)).Put(privkey,sizeof(privkey));
>        cout<<endl<<endl;
>        cout<<"PublicKeyArray is:"<<endl;
>        HexEncoder(new FileSink(cout)).Put(pubkey,sizeof(pubkey));
>
> But I saw this output:
>
> PrivateKeyArray is:
> 30820275
>
> PublicKeyArray is:
> 30819D30

Your printing a single memory address. The address is probably that of
the HexEncoder object.

> byte* privkey;
> byte* pubkey;
> privkey=new byte[PrivateKeyArray.size()];
> pubkey=new byte[PublicKeyArray.size()];
> memcpy(privkey,PrivateKeyArray,PrivateKeyArray.size());
> memcpy(pubkey,PublicKeyArray,PublicKeyArray.size());

I'm not sure about these other gyrations. Sorry.

Jeff

On 2/26/09, Gary <[email protected]> wrote:
>
>
> Hi all;
>
> I've understood that in order to accessing each element of
> "PrivateKeyArray" or "PublicKeyArray" (of type SecByteBlock),I should
> use "[]" operator,(e.g. PrivateKeyArray[i])!
>
> Is it right?
>
> I tried these two different codes in my program:
>
> byte* privkey;
> byte* pubkey;
> privkey=new byte[PrivateKeyArray.size()];
> pubkey=new byte[PublicKeyArray.size()];
> memcpy(privkey,PrivateKeyArray,PrivateKeyArray.size());
> memcpy(pubkey,PublicKeyArray,PublicKeyArray.size());
>
> Then I would show "privkey" and "pubkey" contents in output with these
> codes:
>
>        cout<<"PrivateKeyArray is:"<<endl;
>        HexEncoder(new FileSink(cout)).Put(privkey,sizeof(privkey));
>        cout<<endl<<endl;
>        cout<<"PublicKeyArray is:"<<endl;
>        HexEncoder(new FileSink(cout)).Put(pubkey,sizeof(pubkey));
>
> But I saw this output:
>
> PrivateKeyArray is:
> 30820275
>
> PublicKeyArray is:
> 30819D30
>
> [SNIP]

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