I found this post to this group:

https://groups.google.com/forum/?fromgroups=#!topic/cryptopp-users/kJtKGI6Y0p8

In this example, he seems to be able to successfully use an ArraySink like 
this:

        byte * PrivateArray; 
        byte * PublicArray; 

        CryptoPP::AutoSeededRandomPool rng; 

        // Specify 1024 bit modulus, accept e = 17 
        CryptoPP::RSAES_OAEP_SHA_Decryptor Decryptor( rng, 1024 /*, e */ ); 
        CryptoPP::HexEncoder privArray(new 
            CryptoPP::ArraySink( PrivateArray,sizeof(PrivateArray) ) 
        ); // Hex Encoder 

        Decryptor.DEREncode(privArray); 
        privArray.MessageEnd(); 
        cout <<" Private key is: "; 
        CryptoPP::HexEncoder(privArray).Get(PrivateArray, 
sizeof (PrivateArray)); 
        cout << endl; 

        CryptoPP:: RSAES_OAEP_SHA_Encryptor Encryptor(Decryptor); 
        CryptoPP::HexEncoder pubArray(new 
        CryptoPP::ArraySink(PublicArray,sizeof(PublicArray) ) ); // Hex 
Encoder 
        Encryptor.DEREncode(pubArray); 
        pubArray.MessageEnd(); 
        cout <<" Public key is: "; 
        CryptoPP::HexEncoder(pubArray).Get(PublicArray, 
sizeof(PublicArray)); 
        cout << endl; 

I'm finding two points confusing:

When he uses this:

        CryptoPP::HexEncoder privArray(new 
            CryptoPP::ArraySink( PrivateArray,sizeof(PrivateArray) ) 
        ); // Hex Encoder 

The array PrivateArray has been declared, but it has no size, so 
"sizeof(PrivateArray)" should be 0 (or NULL?).  Does CryptoPP realize this 
and take care of it by creating the array at the length it needs?  And if 
it doesn't, then how would I use any ArraySink without knowing how large it 
will need to be ahead of time?  (This is especially a problem for Gzip.)

The second is afterwards - I know I'm new to C++ and there's a lot I don't 
know, but my understanding is that sizeof(byte*) does not always return an 
accurate answer.  So how after using an ArraySink, how do I know how long 
the array is?

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to