title: Conversion from 'const char *' to 'unsigned char *' in C++?
body: <p>I have an encryption function declared as follows: <code>int encrypt(unsigned char* keydata, int keydata_len, unsigned char *plaintext, int plaintext_len, unsigned char *ciphertext)</code>. This works perfectly and now I call it according to the given snippet.</p>
  
  <pre><code>const char *password = "password";
  len = encrypt(password, (int)strlen(password), (unsigned char*)(content.c_str()), (int)strlen(content.c_str()), ciphertext);
  </code></pre>
  
  <p>On compiling the C++ code I get an error as:</p>
  
  <pre><code>crest.cc:52:13: error: no matching function for call to 'encrypt'
        len = encrypt(password, (int)strlen(password), (unsigned char*)(content.c_str()), (int)strlen(content.c_str()), ciphertext);
              ^~~~~~~
  ./aes.h:10:5: note: candidate function not viable: no known conversion from 'const char *' to 'unsigned char *' for 1st argument
  int encrypt(unsigned char* keydata, int keydata_len, unsigned char *plaintext, int plaintext_len, unsigned char *ciphertext);
  </code></pre>
  
  <p>What is the correct way to typecast in C++ to get around this error ?</p>