title: Encryption with DPAPI without revealing length of unencrypted data?
body: <p>Using the Windows Data Protection API, it is possible to encrypt data in memory, as the following code exemplifies:</p>
  
  <pre><code>byte[] toEncrypt = UnicodeEncoding.ASCII.GetBytes("ThisIsSomeData16");
  
  Console.WriteLine("Original data: " + UnicodeEncoding.ASCII.GetString(toEncrypt));
  Console.WriteLine("Encrypting...");
  
  // Encrypt the data in memory.
  EncryptInMemoryData(toEncrypt, MemoryProtectionScope.SameLogon);
  
  Console.WriteLine("Encrypted data: " + UnicodeEncoding.ASCII.GetString(toEncrypt));
  Console.WriteLine("Decrypting...");
  
  // Decrypt the data in memory.
  DecryptInMemoryData(toEncrypt, MemoryProtectionScope.SameLogon);
  
  Console.WriteLine("Decrypted data: " + UnicodeEncoding.ASCII.GetString(toEncrypt));
  </code></pre>
  
  <p>See the Microsoft reference here: <a href="https://msdn.microsoft.com/en-us/library/ms995355.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/ms995355.aspx</a></p>
  
  <p>However, the encypted data in this example is of equal size as the original data. Is there a way to utilize the DPAPI to encrypt data without revealing the file size of the original file? For example, hiding the generated ciphertext at a "random" spot within the key as is possible with one time pads?</p>