Problem with char * in python
<p>I've just wrapped a header (.h) file and created .so to use it as a module in python. The function Encrypt takes char* bb, then fill it using memcpy(). If I want to call this function from a c code I have to do (char* bb = (char*) new char[200]; Encrypt (...,...,..., bb);). How to call it from python? How is the equivalent of (char* bb = (char*) new char[200];) in python?</p>

<pre><code>int Encrypt (string key, string iv, string plaintext, char* bb)
{
std::string ciphertext;

CryptoPP::AES::Encryption aesEncryption((byte *)key.c_str(), CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption( aesEncryption, (byte *)iv.c_str() );

CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new CryptoPP::StringSink( ciphertext ) );
stfEncryptor.Put( reinterpret_cast&lt;const unsigned char*&gt;( plaintext.c_str() ), plaintext.length() );
stfEncryptor.MessageEnd();

memcpy(bb,ciphertext.c_str(), ciphertext.size());
return ciphertext.size();
};
</code></pre>

<p>Calling Encrypt() from c:</p>

<pre><code>char* bbb = (char*) new char [400];
int sizec = Encrypt(key, iv, plaintext, bbb);
</code></pre>

<p>I used create_string_buffer("", 400) in python but it does not work.</p>
