Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert bits to bytes.

  • Loading branch information...
commit 9f7b65400e1a3ce210eff923063b7c24e9d2956e 1 parent 17f936d
@mehrdada mehrdada authored friism committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 AppHarbor.Web.Security/SymmetricEncryption.cs
View
4 AppHarbor.Web.Security/SymmetricEncryption.cs
@@ -25,7 +25,7 @@ public override byte[] Encrypt(byte[] valueBytes, byte[] initializationVector =
bool generateRandomIV = initializationVector == null;
if (generateRandomIV)
{
- initializationVector = new byte[_algorithm.BlockSize];
+ initializationVector = new byte[_algorithm.BlockSize / 8];
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(initializationVector);
@@ -51,7 +51,7 @@ public override byte[] Decrypt(byte[] encryptedValue, byte[] initializationVecto
int dataOffset = 0;
if (initializationVector == null)
{
- initializationVector = new byte[_algorithm.BlockSize];
+ initializationVector = new byte[_algorithm.BlockSize / 8];
Buffer.BlockCopy(encryptedValue, 0, initializationVector, 0, initializationVector.Length);
dataOffset = initializationVector.Length;
}
Please sign in to comment.
Something went wrong with that request. Please try again.