title: Win32 Encryption with the same size
body: <p>I want to encrypt an array of 15 byte. The problem is I want the cipher text to be of the same size. </p>
  
  <p>What I did as</p>
  
  <ol>
  <li>Make certificate: <strong>makecert.exe -n "CN=me" -sv PrivateKey.pvk -pe Certificate.cer</strong></li>
  <li><p>Write this code to import the certificate and then encrypt the plain text.</p>
  
  <pre><code>BYTE    FileContent[1024];
  DWORD   dwActualFileLen = 0;
  HANDLE  hCertFile;
  if(CryptAcquireContext(&amp;m_hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0))
  {
  hCertFile = CreateFileA("C:\\projects\\Certificate.cer", 
       GENERIC_READ,
       FILE_SHARE_READ, 
       NULL, 
       OPEN_EXISTING,
       FILE_FLAG_SEQUENTIAL_SCAN,
       NULL);
  
  ReadFile(hCertFile, FileContent, 1024, &amp;dwActualFileLen, NULL);
  
  m_CertContext = CertCreateCertificateContext(X509_ASN_ENCODING, FileContent, dwActualFileLen);
  
  CryptImportPublicKeyInfo(m_hCryptProv, X509_ASN_ENCODING, &amp;m_CertContext-&gt;pCertInfo-&gt;SubjectPublicKeyInfo, &amp;m_hPubKey);
  }
  
  CryptEncrypt(m_hPubKey, NULL, TRUE, 0, tempBuffer, &amp;dwNewLen, 128);
  </code></pre></li>
  </ol>
  
  <p>The cipher text is always 128 byte. I want to force it to be of the same size as the plain text.</p>