[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Cryptography
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Cryptography CBCDecrypt.cs,1.1,1.2 CryptoAPITransform.cs,1.6,1.7 CryptoStream.cs,1.2,1.3 DESCryptoServiceProvider.cs,1.1,1.2 DSACryptoServiceProvider.cs,1.3,1.4 DSAParameters.cs,1.4,1.5 ECBDecrypt.cs,1.4,1.5 FromBase64Transform.cs,1.2,1.3 HMACSHA1.cs,1.2,1.3 HashAlgorithm.cs,1.3,1.4 KeyedHashAlgorithm.cs,1.2,1.3 MACTripleDES.cs,1.2,1.3 PKCS1MaskGenerationMethod.cs,1.1,1.2 PasswordDeriveBytes.cs,1.1,1.2 RC2CryptoServiceProvider.cs,1.1,1.2 RSACryptoServiceProvider.cs,1.4,1.5 RSAParameters.cs,1.4,1.5 RijndaelManaged.cs,1.2,1.3 SymmetricAlgorithm.cs,1.5,1.6 TripleDESCryptoServiceProvider.cs,1.2,1.3 |
Date: |
Mon, 14 Apr 2003 06:50:59 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography
In directory subversions:/tmp/cvs-serv4573/runtime/System/Security/Cryptography
Modified Files:
CBCDecrypt.cs CryptoAPITransform.cs CryptoStream.cs
DESCryptoServiceProvider.cs DSACryptoServiceProvider.cs
DSAParameters.cs ECBDecrypt.cs FromBase64Transform.cs
HMACSHA1.cs HashAlgorithm.cs KeyedHashAlgorithm.cs
MACTripleDES.cs PKCS1MaskGenerationMethod.cs
PasswordDeriveBytes.cs RC2CryptoServiceProvider.cs
RSACryptoServiceProvider.cs RSAParameters.cs
RijndaelManaged.cs SymmetricAlgorithm.cs
TripleDESCryptoServiceProvider.cs
Log Message:
Use "Array.Clear" instead of "Array.Initialize" to clear sensitive
values in the cryptographic routines.
Index: CBCDecrypt.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/CBCDecrypt.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** CBCDecrypt.cs 18 Jul 2002 00:30:33 -0000 1.1
--- CBCDecrypt.cs 14 Apr 2003 10:50:55 -0000 1.2
***************
*** 197,201 ****
byte[] newout = new byte [offset];
Array.Copy(outputBuffer, 0, newout, 0,
offset);
! outputBuffer.Initialize();
outputBuffer = newout;
}
--- 197,201 ----
byte[] newout = new byte [offset];
Array.Copy(outputBuffer, 0, newout, 0,
offset);
! Array.Clear(outputBuffer, 0,
outputBuffer.Length);
outputBuffer = newout;
}
Index: CryptoAPITransform.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/CryptoAPITransform.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** CryptoAPITransform.cs 29 Nov 2002 00:33:37 -0000 1.6
--- CryptoAPITransform.cs 14 Apr 2003 10:50:55 -0000 1.7
***************
*** 227,231 ****
if(tempBuffer != null)
{
! tempBuffer.Initialize();
}
tempSize = 0;
--- 227,231 ----
if(tempBuffer != null)
{
! Array.Clear(tempBuffer, 0,
tempBuffer.Length);
}
tempSize = 0;
***************
*** 233,237 ****
{
// Usually not sensitive, but let's be
paranoid anyway.
! iv.Initialize();
}
}
--- 233,237 ----
{
// Usually not sensitive, but let's be
paranoid anyway.
! Array.Clear(iv, 0, iv.Length);
}
}
Index: CryptoStream.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/CryptoStream.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** CryptoStream.cs 26 Nov 2002 11:50:00 -0000 1.2
--- CryptoStream.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 159,167 ****
if(inBuffer != null)
{
! inBuffer.Initialize();
}
if(outBuffer != null)
{
! outBuffer.Initialize();
}
if(transform != null && transform is
IDisposable)
--- 159,167 ----
if(inBuffer != null)
{
! Array.Clear(inBuffer, 0,
inBuffer.Length);
}
if(outBuffer != null)
{
! Array.Clear(outBuffer, 0,
outBuffer.Length);
}
if(transform != null && transform is
IDisposable)
***************
*** 189,193 ****
{
stream.Write(buf, 0, buf.Length);
! buf.Initialize();
}
flushFinal = true;
--- 189,193 ----
{
stream.Write(buf, 0, buf.Length);
! Array.Clear(buf, 0, buf.Length);
}
flushFinal = true;
***************
*** 224,229 ****
// Clear the buffers, in case they contained
plaintext data.
! inBuffer.Initialize();
! outBuffer.Initialize();
}
--- 224,229 ----
// Clear the buffers, in case they contained
plaintext data.
! Array.Clear(inBuffer, 0, inBuffer.Length);
! Array.Clear(outBuffer, 0, outBuffer.Length);
}
***************
*** 325,329 ****
(inBuffer, 0, inBufferPosn);
inBufferPosn = 0;
! outBuffer.Initialize();
outBuffer = buf;
outBufferPosn = 0;
--- 325,329 ----
(inBuffer, 0, inBufferPosn);
inBufferPosn = 0;
! Array.Clear(outBuffer,
0, outBuffer.Length);
outBuffer = buf;
outBufferPosn = 0;
Index: DESCryptoServiceProvider.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/DESCryptoServiceProvider.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DESCryptoServiceProvider.cs 6 Jul 2002 07:03:07 -0000 1.1
--- DESCryptoServiceProvider.cs 14 Apr 2003 10:50:55 -0000 1.2
***************
*** 84,88 ****
{
// Clear the previous key value.
! KeyValue.Initialize();
}
KeyValue = key;
--- 84,88 ----
{
// Clear the previous key value.
! Array.Clear(KeyValue, 0,
KeyValue.Length);
}
KeyValue = key;
Index: DSACryptoServiceProvider.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/DSACryptoServiceProvider.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** DSACryptoServiceProvider.cs 26 Nov 2002 11:50:00 -0000 1.3
--- DSACryptoServiceProvider.cs 14 Apr 2003 10:50:55 -0000 1.4
***************
*** 82,86 ****
// the key is X.509, bare
public, or private.
dsaParams.ASN1ToPublic(key, 0,
key.Length);
! key.Initialize();
persistKey = true;
}
--- 82,86 ----
// the key is X.509, bare
public, or private.
dsaParams.ASN1ToPublic(key, 0,
key.Length);
! Array.Clear(key, 0, key.Length);
persistKey = true;
}
***************
*** 219,223 ****
(dsaParams.G, K, dsaParams.P);
byte[] R = CryptoMethods.NumMod(temp1,
dsaParams.Q);
! temp1.Initialize();
// Compute S = ((K^-1 * (hash + X * R)) mod Q)
--- 219,223 ----
(dsaParams.G, K, dsaParams.P);
byte[] R = CryptoMethods.NumMod(temp1,
dsaParams.Q);
! Array.Clear(temp1, 0, temp1.Length);
// Compute S = ((K^-1 * (hash + X * R)) mod Q)
***************
*** 228,235 ****
(rgbHash, temp2, dsaParams.Q);
byte[] S = CryptoMethods.NumMul(temp1, temp3,
dsaParams.Q);
! temp1.Initialize();
! temp2.Initialize();
! temp3.Initialize();
! K.Initialize();
// Pack R and S into a signature blob and
return it.
--- 228,235 ----
(rgbHash, temp2, dsaParams.Q);
byte[] S = CryptoMethods.NumMul(temp1, temp3,
dsaParams.Q);
! Array.Clear(temp1, 0, temp1.Length);
! Array.Clear(temp2, 0, temp2.Length);
! Array.Clear(temp3, 0, temp3.Length);
! Array.Clear(K, 0, K.Length);
// Pack R and S into a signature blob and
return it.
***************
*** 238,243 ****
builder.AddBigInt(S);
byte[] sig = builder.ToByteArray();
! R.Initialize();
! S.Initialize();
return sig;
}
--- 238,243 ----
builder.AddBigInt(S);
byte[] sig = builder.ToByteArray();
! Array.Clear(R, 0, R.Length);
! Array.Clear(S, 0, S.Length);
return sig;
}
***************
*** 325,337 ****
// Clear sensitive values.
! R.Initialize();
! S.Initialize();
! W.Initialize();
! U1.Initialize();
! U2.Initialize();
! temp1.Initialize();
! temp2.Initialize();
! temp3.Initialize();
! V.Initialize();
// Done.
--- 325,337 ----
// Clear sensitive values.
! Array.Clear(R, 0, R.Length);
! Array.Clear(S, 0, S.Length);
! Array.Clear(W, 0, W.Length);
! Array.Clear(U1, 0, U1.Length);
! Array.Clear(U2, 0, U2.Length);
! Array.Clear(temp1, 0, temp1.Length);
! Array.Clear(temp2, 0, temp2.Length);
! Array.Clear(temp3, 0, temp3.Length);
! Array.Clear(V, 0, V.Length);
// Done.
***************
*** 345,349 ****
.ComputeHash(buffer);
byte[] signature = CreateSignature(hash);
! hash.Initialize();
return signature;
}
--- 345,349 ----
.ComputeHash(buffer);
byte[] signature = CreateSignature(hash);
! Array.Clear(hash, 0, hash.Length);
return signature;
}
***************
*** 355,359 ****
.ComputeHash(inputStream);
byte[] signature = CreateSignature(hash);
! hash.Initialize();
return signature;
}
--- 355,359 ----
.ComputeHash(inputStream);
byte[] signature = CreateSignature(hash);
! Array.Clear(hash, 0, hash.Length);
return signature;
}
***************
*** 365,369 ****
.ComputeHash(buffer, offset, count);
byte[] signature = CreateSignature(hash);
! hash.Initialize();
return signature;
}
--- 365,369 ----
.ComputeHash(buffer, offset, count);
byte[] signature = CreateSignature(hash);
! Array.Clear(hash, 0, hash.Length);
return signature;
}
***************
*** 390,394 ****
.ComputeHash(rgbData);
bool result = VerifySignature(hash,
rgbSignature);
! hash.Initialize();
return result;
}
--- 390,394 ----
.ComputeHash(rgbData);
bool result = VerifySignature(hash,
rgbSignature);
! Array.Clear(hash, 0, hash.Length);
return result;
}
Index: DSAParameters.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/DSAParameters.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** DSAParameters.cs 12 Jul 2002 06:28:32 -0000 1.4
--- DSAParameters.cs 14 Apr 2003 10:50:55 -0000 1.5
***************
*** 42,52 ****
{
Counter = 0;
! if(G != null) { G.Initialize(); G = null; }
! if(J != null) { J.Initialize(); J = null; }
! if(P != null) { P.Initialize(); P = null; }
! if(Q != null) { Q.Initialize(); Q = null; }
! if(Seed != null) { Seed.Initialize(); Seed =
null; }
! if(X != null) { X.Initialize(); X = null; }
! if(Y != null) { Y.Initialize(); Y = null; }
}
--- 42,80 ----
{
Counter = 0;
! if(G != null)
! {
! Array.Clear(G, 0, G.Length);
! G = null;
! }
! if(J != null)
! {
! Array.Clear(J, 0, J.Length);
! J = null;
! }
! if(P != null)
! {
! Array.Clear(P, 0, P.Length);
! P = null;
! }
! if(Q != null)
! {
! Array.Clear(Q, 0, Q.Length);
! Q = null;
! }
! if(Seed != null)
! {
! Array.Clear(Seed, 0, Seed.Length);
! Seed = null;
! }
! if(X != null)
! {
! Array.Clear(X, 0, X.Length);
! X = null;
! }
! if(Y != null)
! {
! Array.Clear(Y, 0, Y.Length);
! Y = null;
! }
}
Index: ECBDecrypt.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/ECBDecrypt.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** ECBDecrypt.cs 29 Nov 2002 00:33:37 -0000 1.4
--- ECBDecrypt.cs 14 Apr 2003 10:50:55 -0000 1.5
***************
*** 166,170 ****
Array.Copy(outputBuffer, 0,
newout, 0, offset);
}
! outputBuffer.Initialize();
outputBuffer = newout;
}
--- 166,170 ----
Array.Copy(outputBuffer, 0,
newout, 0, offset);
}
! Array.Clear(outputBuffer, 0,
outputBuffer.Length);
outputBuffer = newout;
}
Index: FromBase64Transform.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/FromBase64Transform.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** FromBase64Transform.cs 26 Nov 2002 11:50:00 -0000 1.2
--- FromBase64Transform.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 95,99 ****
if(inBuffer != null)
{
! inBuffer.Initialize();
}
inBufPosn = 0;
--- 95,99 ----
if(inBuffer != null)
{
! Array.Clear(inBuffer, 0,
inBuffer.Length);
}
inBufPosn = 0;
***************
*** 187,191 ****
byte[] newout = new byte [offset];
Array.Copy(outputBuffer, 0, newout, 0,
offset);
! outputBuffer.Initialize();
return newout;
}
--- 187,191 ----
byte[] newout = new byte [offset];
Array.Copy(outputBuffer, 0, newout, 0,
offset);
! Array.Clear(outputBuffer, 0,
outputBuffer.Length);
return newout;
}
Index: HMACSHA1.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/HMACSHA1.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** HMACSHA1.cs 27 Nov 2002 05:04:08 -0000 1.2
--- HMACSHA1.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 163,167 ****
}
alg.InternalHashCore(inner, 0, inner.Length);
! inner.Initialize();
return alg.InternalHashFinal();
}
--- 163,167 ----
}
alg.InternalHashCore(inner, 0, inner.Length);
! Array.Clear(inner, 0, inner.Length);
return alg.InternalHashFinal();
}
Index: HashAlgorithm.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/HashAlgorithm.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** HashAlgorithm.cs 26 Nov 2002 11:50:00 -0000 1.3
--- HashAlgorithm.cs 14 Apr 2003 10:50:55 -0000 1.4
***************
*** 116,120 ****
if(HashValue != null)
{
! HashValue.Initialize();
HashValue = null;
}
--- 116,120 ----
if(HashValue != null)
{
! Array.Clear(HashValue, 0,
HashValue.Length);
HashValue = null;
}
Index: KeyedHashAlgorithm.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/KeyedHashAlgorithm.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** KeyedHashAlgorithm.cs 27 Nov 2002 05:04:08 -0000 1.2
--- KeyedHashAlgorithm.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 46,50 ****
if(KeyValue != null)
{
! KeyValue.Initialize();
}
base.Dispose(disposing);
--- 46,50 ----
if(KeyValue != null)
{
! Array.Clear(KeyValue, 0,
KeyValue.Length);
}
base.Dispose(disposing);
Index: MACTripleDES.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/MACTripleDES.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** MACTripleDES.cs 27 Nov 2002 05:04:08 -0000 1.2
--- MACTripleDES.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 81,85 ****
if(block != null)
{
! block.Initialize();
}
if(alg != null)
--- 81,85 ----
if(block != null)
{
! Array.Clear(block, 0, block.Length);
}
if(alg != null)
***************
*** 116,120 ****
stream.Close();
stream = null;
! block.Initialize();
}
}
--- 116,120 ----
stream.Close();
stream = null;
! Array.Clear(block, 0, block.Length);
}
}
***************
*** 146,150 ****
stream = null;
byte[] hash = (byte[])(block.Clone());
! block.Initialize();
return hash;
}
--- 146,150 ----
stream = null;
byte[] hash = (byte[])(block.Clone());
! Array.Clear(block, 0, block.Length);
return hash;
}
Index: PKCS1MaskGenerationMethod.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/PKCS1MaskGenerationMethod.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** PKCS1MaskGenerationMethod.cs 8 Jul 2002 05:53:14 -0000 1.1
--- PKCS1MaskGenerationMethod.cs 14 Apr 2003 10:50:55 -0000 1.2
***************
*** 107,116 ****
Array.Copy(hash, 0, mask,
index, cbReturn - index);
}
! hash.Initialize();
alg.Initialize();
++count;
index += hashSize;
}
! numbuf.Initialize();
// The mask has been generated.
--- 107,116 ----
Array.Copy(hash, 0, mask,
index, cbReturn - index);
}
! Array.Clear(hash, 0, hash.Length);
alg.Initialize();
++count;
index += hashSize;
}
! Array.Clear(numbuf, 0, numbuf.Length);
// The mask has been generated.
Index: PasswordDeriveBytes.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/PasswordDeriveBytes.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** PasswordDeriveBytes.cs 12 Jul 2002 06:28:32 -0000 1.1
--- PasswordDeriveBytes.cs 14 Apr 2003 10:50:55 -0000 1.2
***************
*** 66,70 ****
if(block != null)
{
! block.Initialize();
}
}
--- 66,70 ----
if(block != null)
{
! Array.Clear(block, 0, block.Length);
}
}
***************
*** 146,150 ****
byte[] pwd =
Encoding.UTF8.GetBytes(strPassword);
md5.InternalHashCore(pwd, 0,
pwd.Length);
! pwd.Initialize();
}
if(rgbSalt != null)
--- 146,150 ----
byte[] pwd =
Encoding.UTF8.GetBytes(strPassword);
md5.InternalHashCore(pwd, 0,
pwd.Length);
! Array.Clear(pwd, 0, pwd.Length);
}
if(rgbSalt != null)
***************
*** 158,162 ****
{
md5.InternalHashCore(tempHash,
0, tempHash.Length);
! tempHash.Initialize();
tempHash =
md5.InternalHashFinal();
md5.Initialize();
--- 158,162 ----
{
md5.InternalHashCore(tempHash,
0, tempHash.Length);
! Array.Clear(tempHash, 0,
tempHash.Length);
tempHash =
md5.InternalHashFinal();
md5.Initialize();
***************
*** 169,173 ****
Array.Copy(tempHash, 8, rgbIV,
0, 8);
}
! tempHash.Initialize();
return key;
}
--- 169,173 ----
Array.Copy(tempHash, 8, rgbIV,
0, 8);
}
! Array.Clear(tempHash, 0,
tempHash.Length);
return key;
}
***************
*** 185,189 ****
byte[] iv =
GetBytes(rgbIV.Length);
Array.Copy(iv, 0, rgbIV, 0,
rgbIV.Length);
! iv.Initialize();
}
return result;
--- 185,189 ----
byte[] iv =
GetBytes(rgbIV.Length);
Array.Copy(iv, 0, rgbIV, 0,
rgbIV.Length);
! Array.Clear(iv, 0, iv.Length);
}
return result;
***************
*** 236,240 ****
byte[] pwd =
Encoding.UTF8.GetBytes(strPassword);
hashAlgorithm.InternalHashCore(pwd, 0, pwd.Length);
! pwd.Initialize();
}
if(rgbSalt != null)
--- 236,240 ----
byte[] pwd =
Encoding.UTF8.GetBytes(strPassword);
hashAlgorithm.InternalHashCore(pwd, 0, pwd.Length);
! Array.Clear(pwd, 0, pwd.Length);
}
if(rgbSalt != null)
***************
*** 249,253 ****
numbuf[3] = (byte)blockNum;
hashAlgorithm.InternalHashCore(numbuf,
0, 4);
! numbuf.Initialize();
byte[] lastHash =
hashAlgorithm.InternalHashFinal();
hashAlgorithm.Initialize();
--- 249,253 ----
numbuf[3] = (byte)blockNum;
hashAlgorithm.InternalHashCore(numbuf,
0, 4);
! Array.Clear(numbuf, 0, numbuf.Length);
byte[] lastHash =
hashAlgorithm.InternalHashFinal();
hashAlgorithm.Initialize();
***************
*** 265,274 ****
lastHash[tempindex] ^=
temphash[tempindex];
}
! temphash.Initialize();
--templen;
}
if(block != null)
{
! block.Initialize();
}
block = lastHash;
--- 265,274 ----
lastHash[tempindex] ^=
temphash[tempindex];
}
! Array.Clear(temphash, 0,
temphash.Length);
--templen;
}
if(block != null)
{
! Array.Clear(block, 0,
block.Length);
}
block = lastHash;
***************
*** 288,292 ****
if(block != null)
{
! block.Initialize();
}
}
--- 288,292 ----
if(block != null)
{
! Array.Clear(block, 0, block.Length);
}
}
Index: RC2CryptoServiceProvider.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/RC2CryptoServiceProvider.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** RC2CryptoServiceProvider.cs 6 Jul 2002 07:03:07 -0000 1.1
--- RC2CryptoServiceProvider.cs 14 Apr 2003 10:50:55 -0000 1.2
***************
*** 79,83 ****
{
// Clear the previous key value.
! KeyValue.Initialize();
}
KeyValue = key;
--- 79,83 ----
{
// Clear the previous key value.
! Array.Clear(KeyValue, 0,
KeyValue.Length);
}
KeyValue = key;
Index: RSACryptoServiceProvider.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/RSACryptoServiceProvider.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** RSACryptoServiceProvider.cs 26 Nov 2002 11:50:00 -0000 1.4
--- RSACryptoServiceProvider.cs 14 Apr 2003 10:50:55 -0000 1.5
***************
*** 68,72 ****
// the key is X.509, bare
public, or private.
rsaParams.ASN1ToPublic(key, 0,
key.Length);
! key.Initialize();
persistKey = true;
}
--- 68,72 ----
// the key is X.509, bare
public, or private.
rsaParams.ASN1ToPublic(key, 0,
key.Length);
! Array.Clear(key, 0, key.Length);
persistKey = true;
}
***************
*** 179,187 ****
// Clear all temporary values.
! m1.Initialize();
! m2.Initialize();
! diff.Initialize();
! h.Initialize();
! prod.Initialize();
// Return the decrypted message.
--- 179,187 ----
// Clear all temporary values.
! Array.Clear(m1, 0, m1.Length);
! Array.Clear(m2, 0, m2.Length);
! Array.Clear(diff, 0, diff.Length);
! Array.Clear(h, 0, h.Length);
! Array.Clear(prod, 0, prod.Length);
// Return the decrypted message.
***************
*** 232,236 ****
if(decrypted.Length > k)
{
! decrypted.Initialize();
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
--- 232,236 ----
if(decrypted.Length > k)
{
! Array.Clear(decrypted, 0,
decrypted.Length);
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
***************
*** 284,293 ****
{
// Something is wrong with the
decrypted padding data.
! decrypted.Initialize();
! msg.Initialize();
! maskedMsg.Initialize();
! seedMask.Initialize();
! seed.Initialize();
! msgMask.Initialize();
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
--- 284,293 ----
{
// Something is wrong with the
decrypted padding data.
! Array.Clear(decrypted, 0,
decrypted.Length);
! Array.Clear(msg, 0, msg.Length);
! Array.Clear(maskedMsg, 0,
maskedMsg.Length);
! Array.Clear(seedMask, 0,
seedMask.Length);
! Array.Clear(seed, 0, seed.Length);
! Array.Clear(msgMask, 0, msgMask.Length);
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
***************
*** 301,310 ****
// Destroy sensitive values.
! decrypted.Initialize();
! msg.Initialize();
! maskedMsg.Initialize();
! seedMask.Initialize();
! seed.Initialize();
! msgMask.Initialize();
// Done.
--- 301,310 ----
// Destroy sensitive values.
! Array.Clear(decrypted, 0, decrypted.Length);
! Array.Clear(msg, 0, msg.Length);
! Array.Clear(maskedMsg, 0, maskedMsg.Length);
! Array.Clear(seedMask, 0, seedMask.Length);
! Array.Clear(seed, 0, seed.Length);
! Array.Clear(msgMask, 0, msgMask.Length);
// Done.
***************
*** 342,346 ****
if(decrypted.Length > k)
{
! decrypted.Initialize();
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
--- 342,346 ----
if(decrypted.Length > k)
{
! Array.Clear(decrypted, 0,
decrypted.Length);
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
***************
*** 363,368 ****
if(error != 0)
{
! decrypted.Initialize();
! msg.Initialize();
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
--- 363,368 ----
if(error != 0)
{
! Array.Clear(decrypted, 0,
decrypted.Length);
! Array.Clear(msg, 0, msg.Length);
throw new CryptographicException
(_("Crypto_RSAInvalidCiphertext"));
***************
*** 375,380 ****
// Destroy sensitive values.
! decrypted.Initialize();
! msg.Initialize();
// Done.
--- 375,380 ----
// Destroy sensitive values.
! Array.Clear(decrypted, 0, decrypted.Length);
! Array.Clear(msg, 0, msg.Length);
// Done.
***************
*** 484,492 ****
// Destroy sensitive data.
! msg.Initialize();
! seed.Initialize();
! mask.Initialize();
! seedMask.Initialize();
! value.Initialize();
// Done.
--- 484,492 ----
// Destroy sensitive data.
! Array.Clear(msg, 0, msg.Length);
! Array.Clear(seed, 0, seed.Length);
! Array.Clear(mask, 0, mask.Length);
! Array.Clear(seedMask, 0, seedMask.Length);
! Array.Clear(value, 0, value.Length);
// Done.
***************
*** 528,533 ****
// Destroy sensitive data.
! msg.Initialize();
! padding.Initialize();
// Done.
--- 528,533 ----
// Destroy sensitive data.
! Array.Clear(msg, 0, msg.Length);
! Array.Clear(padding, 0, padding.Length);
// Done.
***************
*** 759,768 ****
Array.Copy(signedValue, 0, zextend, k -
signedValue.Length,
signedValue.Length);
! signedValue.Initialize();
signedValue = zextend;
}
// Destroy sensitive values.
! msg.Initialize();
// Done.
--- 759,768 ----
Array.Copy(signedValue, 0, zextend, k -
signedValue.Length,
signedValue.Length);
! Array.Clear(signedValue, 0,
signedValue.Length);
signedValue = zextend;
}
// Destroy sensitive values.
! Array.Clear(msg, 0, msg.Length);
// Done.
***************
*** 841,845 ****
Array.Copy(msg, 0, zextend, k -
msg.Length,
msg.Length);
! msg.Initialize();
msg = zextend;
}
--- 841,845 ----
Array.Copy(msg, 0, zextend, k -
msg.Length,
msg.Length);
! Array.Clear(msg, 0, msg.Length);
msg = zextend;
}
***************
*** 869,873 ****
// Destroy sensitive values.
! msg.Initialize();
// Done.
--- 869,873 ----
// Destroy sensitive values.
! Array.Clear(msg, 0, msg.Length);
// Done.
Index: RSAParameters.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/RSAParameters.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** RSAParameters.cs 12 Jul 2002 06:28:32 -0000 1.4
--- RSAParameters.cs 14 Apr 2003 10:50:55 -0000 1.5
***************
*** 41,52 ****
internal void Clear()
{
! if(Exponent != null) { Exponent.Initialize();
Exponent = null; }
! if(Modulus != null) { Modulus.Initialize();
Modulus = null; }
! if(D != null) { D.Initialize(); D = null; }
! if(DP != null) { DP.Initialize(); DP = null; }
! if(DQ != null) { DQ.Initialize(); DQ = null; }
! if(InverseQ != null) { InverseQ.Initialize();
InverseQ = null; }
! if(P != null) { P.Initialize(); P = null; }
! if(Q != null) { Q.Initialize(); Q = null; }
}
--- 41,84 ----
internal void Clear()
{
! if(Exponent != null)
! {
! Array.Clear(Exponent, 0,
Exponent.Length);
! Exponent = null;
! }
! if(Modulus != null)
! {
! Array.Clear(Modulus, 0, Modulus.Length);
! Modulus = null;
! }
! if(D != null)
! {
! Array.Clear(D, 0, D.Length);
! D = null;
! }
! if(DP != null)
! {
! Array.Clear(DP, 0, DP.Length);
! DP = null;
! }
! if(DQ != null)
! {
! Array.Clear(DQ, 0, DQ.Length);
! DQ = null;
! }
! if(InverseQ != null)
! {
! Array.Clear(InverseQ, 0,
InverseQ.Length);
! InverseQ = null;
! }
! if(P != null)
! {
! Array.Clear(P, 0, P.Length);
! P = null;
! }
! if(Q != null)
! {
! Array.Clear(Q, 0, Q.Length);
! Q = null;
! }
}
Index: RijndaelManaged.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/RijndaelManaged.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** RijndaelManaged.cs 27 Nov 2002 02:13:22 -0000 1.2
--- RijndaelManaged.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 79,83 ****
{
// Clear the previous key value.
! KeyValue.Initialize();
}
KeyValue = key;
--- 79,83 ----
{
// Clear the previous key value.
! Array.Clear(KeyValue, 0,
KeyValue.Length);
}
KeyValue = key;
Index: SymmetricAlgorithm.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/SymmetricAlgorithm.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** SymmetricAlgorithm.cs 26 Nov 2002 11:50:00 -0000 1.5
--- SymmetricAlgorithm.cs 14 Apr 2003 10:50:55 -0000 1.6
***************
*** 250,258 ****
if(KeyValue != null)
{
! KeyValue.Initialize();
}
if(IVValue != null)
{
! IVValue.Initialize();
}
}
--- 250,258 ----
if(KeyValue != null)
{
! Array.Clear(KeyValue, 0,
KeyValue.Length);
}
if(IVValue != null)
{
! Array.Clear(IVValue, 0, IVValue.Length);
}
}
Index: TripleDESCryptoServiceProvider.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Cryptography/TripleDESCryptoServiceProvider.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** TripleDESCryptoServiceProvider.cs 27 Nov 2002 02:13:22 -0000 1.2
--- TripleDESCryptoServiceProvider.cs 14 Apr 2003 10:50:55 -0000 1.3
***************
*** 83,87 ****
{
// Clear the previous key value.
! KeyValue.Initialize();
}
KeyValue = key;
--- 83,87 ----
{
// Clear the previous key value.
! Array.Clear(KeyValue, 0,
KeyValue.Length);
}
KeyValue = key;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Cryptography CBCDecrypt.cs,1.1,1.2 CryptoAPITransform.cs,1.6,1.7 CryptoStream.cs,1.2,1.3 DESCryptoServiceProvider.cs,1.1,1.2 DSACryptoServiceProvider.cs,1.3,1.4 DSAParameters.cs,1.4,1.5 ECBDecrypt.cs,1.4,1.5 FromBase64Transform.cs,1.2,1.3 HMACSHA1.cs,1.2,1.3 HashAlgorithm.cs,1.3,1.4 KeyedHashAlgorithm.cs,1.2,1.3 MACTripleDES.cs,1.2,1.3 PKCS1MaskGenerationMethod.cs,1.1,1.2 PasswordDeriveBytes.cs,1.1,1.2 RC2CryptoServiceProvider.cs,1.1,1.2 RSACryptoServiceProvider.cs,1.4,1.5 RSAParameters.cs,1.4,1.5 RijndaelManaged.cs,1.2,1.3 SymmetricAlgorithm.cs,1.5,1.6 TripleDESCryptoServiceProvider.cs,1.2,1.3,
Rhys Weatherley <address@hidden> <=