Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security/Mono.Security.Cryptography
In directory sc8-pr-cvs1:/tmp/cvs-serv7195
Modified Files:
PKCS1.cs
Log Message:
2003-12-21 Carlos Guzmán Álvarez <car...@te...>
* Mono.Security.Cryptography/PKCS1.cs:
- Added change to Encode_v15 method for allow correct
encoding of hash algorithms that doesn't have an OID
like the MD5SHA1 hash used in SSL/TLS protocols.
Index: PKCS1.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security/Mono.Security.Cryptography/PKCS1.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PKCS1.cs 14 Dec 2003 15:01:08 -0000 1.1
--- PKCS1.cs 21 Dec 2003 14:52:03 -0000 1.2
***************
*** 291,310 ****
// digest OCTET STRING
// }
! /*
! string oid = CryptoConfig.MapNameToOID (hash.ToString ());
! ASN1 digestAlgorithm = new ASN1 (0x30);
! digestAlgorithm.Add (new ASN1 (CryptoConfig.EncodeOID (oid)));
! digestAlgorithm.Add (new ASN1 (0x05)); // NULL
! ASN1 digest = new ASN1 (0x04, hashValue);
! ASN1 digestInfo = new ASN1 (0x30);
! digestInfo.Add (digestAlgorithm);
! digestInfo.Add (digest);
! byte[] t = digestInfo.GetBytes ();
! */
! ASN1 digestInfo = new ASN1 (0x30);
! digestInfo.Add (new ASN1 (0x04, hashValue));
! byte[] t = digestInfo.GetBytes();
Array.Copy (hashValue, 0, t, t.Length - hashValue.Length, hashValue.Length);
--- 291,316 ----
// digest OCTET STRING
// }
!
! byte[] t = null;
! string oid = CryptoConfig.MapNameToOID (hash.ToString ());
! if (oid != null)
! {
! ASN1 digestAlgorithm = new ASN1 (0x30);
! digestAlgorithm.Add (new ASN1 (CryptoConfig.EncodeOID (oid)));
! digestAlgorithm.Add (new ASN1 (0x05)); // NULL
! ASN1 digest = new ASN1 (0x04, hashValue);
! ASN1 digestInfo = new ASN1 (0x30);
! digestInfo.Add (digestAlgorithm);
! digestInfo.Add (digest);
! t = digestInfo.GetBytes ();
! }
! else
! {
! // There are no valid OID, in this case t = hashValue
! // This is the case of the MD5SHA hash algorithm
! t = hashValue;
! }
Array.Copy (hashValue, 0, t, t.Length - hashValue.Length, hashValue.Length);
|