+2003-05-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * PKCS1.cs: Corrected I2OSP to match PKCS#1 v.2.1 test vector
+ and fix the OAEP incompatibility issue.
+
2003-04-01 Sebastien Pouliot <spouliot@videotron.ca>
* PKCS1.cs: Corrected fix (partially) for the lame PKCS1 v1.5
// Author:
// Sebastien Pouliot (spouliot@motus.com)
//
-// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
using System;
public static byte[] I2OSP (int x, int size)
{
byte[] array = BitConverter.GetBytes (x);
+ Array.Reverse (array, 0, array.Length);
return I2OSP (array, size);
}
byte[] DB = xor (maskedDB, dbMask);
byte[] lHash = GetEmptyHash (hash);
- // split DB = lHash\19 || PS || 0x01 || M
+ // split DB = lHash' || PS || 0x01 || M
byte[] dbHash = new byte [lHash.Length];
Array.Copy (DB, 0, dbHash, 0, dbHash.Length);
bool h = Compare (lHash, dbHash);
// 3. For counter from 0 to (maskLen / hLen) \13 1, do the following:
for (int counter = 0; counter < iterations; counter++) {
// a. Convert counter to an octet string C of length 4 octets
- byte[] C = I2OSP (counter, 4);
+ byte[] C = I2OSP (counter, 4);
// b. Concatenate the hash of the seed mgfSeed and C to the octet string T:
// T = T || Hash (mgfSeed || C)