Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The size of the plain text does not matter. Just make sure you use the exact same IV and Key along with the encrypted bytes in the decryptStringFromBytes_AES(byte[] cipherText, byte[] Key, byte[] IV) method. That will return back to you the entered plain text.</p> <p>For example:</p> <pre><code> string plain_text = "Cool this works"; byte[] iv = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; byte[] key = new byte[] { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; byte[] encrytped_text = encryptStringToBytes_AES(plain_text, key, iv); string plain_text_again = decryptStringFromBytes_AES(encrypted_text, key, iv); </code></pre> <p>Here you should see that plain-text and plain-text-again are the same. Now go ahead and change plain_text to anything you want and see that this works fine.</p> <p>The default values for RijndaelManaged are:<br> BlockSize: 128<br> KeySize: 256<br> Mode: CipherMode.CBC<br> Padding: PaddingMode.PKCS7<br></p> <p>The valid IV sizes are:<br> 128, 192, 256 bits (This is the BlockSize, make sure to set it to size IV you are using)<br> The valid Key sizes are:<br> 128, 192, 256 bits (This is the KeySize, make sure to set it to the size key you are using)<br></p> <p>This means that the byte[] iv can be 16, 24, or 32 bytes (in my above example its 16 bytes) and the byte[] key can also be 16, 24, or 32 bytes (in my above example its 16 bytes).</p> <p>Hope that helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload