title: rsa_private_decrypt returns -1, error 0x0306B067
body: <p>I want to test a RSA key pair using OpenSSL in C++. I encrypt a text and decrypt it immediately. The encryption is done successfully but the decryption return -1 always. The error number is:</p>
  
  <pre><code>0306B067:lib(3):func(107):reason(103)
  </code></pre>
  
  <p>I couldn't find out the reason... the code is:</p>
  
  <pre><code>char* text = "hello!!!";
  unsigned char * cipher ;
  unsigned char * decipher ;
  int size = RSA_size(prvKey);
  cipher = (unsigned char *)malloc(size);
  decipher = (unsigned char *)malloc(size);
  int cipherres = RSA_public_encrypt(size - 11/*strlen(text)*/,(unsigned char*)text,cipher,pubKey,RSA_PKCS1_PADDING);
  
  int decipherres = RSA_private_decrypt(size,cipher,decipher,prvKey,RSA_PKCS1_PADDING);
  if (decipherres == -1)
  </code></pre>
  
  <p>RSA key pair was generated befor using <code>RSA_generate_key_ex()</code> function and it's key pair are in pubKey and prvKey.</p>