Hi Gary, > But now,I'd like to know this only for increasing my knowledge about > it: > >> You saw what you should see. You only put sizeof(pubkey) into the hex >> encoder, so it only encoded sizeof(pubkey) bytes. pubkey is a byte *, >> so sizeof(pubkey) is 4 bytes on most 32-bit platforms. > > How can I put all elements of "pubkey" or "privkey"(of type byte*) > into hex encoder to show in output? > With which code?
byte * doesn't have any record of its own size. If you want to use those, you need to have some mechanism in place in your program to keep track of it. Sometimes, you just keep another variable around. Other times you use a wrapper object like SecByteBlock. So for example: SecByteBlock pubBB; // do things to fill pubBB with a public key ... size_t publen = pubBB.size(); // need to keep track of this if you want to use a bare byte * byte * pubkey = new byte[publen]; memcpy(pubkey,pubBB,publen); HexEncoder(new FileSink(cout)).Put(pubkey,publen); 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. -~----------~----~----~----~------~----~------~--~---
