Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client
In directory sc8-pr-cvs1:/tmp/cvs-serv32542
Modified Files:
TlsClientCertificateVerify.cs TlsServerCertificate.cs
TlsServerKeyExchange.cs
Log Message:
Cleanup
Index: TlsClientCertificateVerify.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** TlsClientCertificateVerify.cs 14 Dec 2003 15:01:54 -0000 1.16
--- TlsClientCertificateVerify.cs 26 Dec 2003 11:17:14 -0000 1.17
***************
*** 68,73 ****
(int)this.Context.HandshakeMessages.Length);
// Write message
! Write(hash.CreateSignature(this.Context.Cipher.CertificateRSA()));
}
--- 68,122 ----
(int)this.Context.HandshakeMessages.Length);
+ // RSAManaged of the selected ClientCertificate
+ // (at this moment the first one)
+ RSA rsa = getClientCertRSA();
+
// Write message
! Write(hash.CreateSignature(rsa));
! }
!
! #endregion
!
! #region Private methods
!
! private RSA getClientCertRSA()
! {
! RSAParameters rsaParams = new RSAParameters();
! // for RSA m_publickey contains 2 ASN.1 integers
! // the modulus and the public exponent
! ASN1 pubkey = new ASN1 (this.Context.ClientSettings.Certificates[0].GetPublicKey());
! ASN1 modulus = pubkey [0];
! if ((modulus == null) || (modulus.Tag != 0x02))
! return null;
! ASN1 exponent = pubkey [1];
! if (exponent.Tag != 0x02)
! return null;
!
! rsaParams.Modulus = this.getUnsignedBigInteger(modulus.Value);
! rsaParams.Exponent = exponent.Value;
!
! // BUG: MS BCL 1.0 can't import a key which
! // isn't the same size as the one present in
! // the container.
! int keySize = (rsaParams.Modulus.Length << 3);
! RSAManaged rsa = new RSAManaged(keySize);
! rsa.ImportParameters (rsaParams);
!
! return (RSA)rsa;
! }
!
! private byte[] getUnsignedBigInteger(byte[] integer)
! {
! if (integer [0] == 0x00)
! {
! // this first byte is added so we're sure it's an unsigned integer
! // however we can't feed it into RSAParameters or DSAParameters
! int length = integer.Length - 1;
! byte[] uinteger = new byte [length];
! Array.Copy (integer, 1, uinteger, 0, length);
! return uinteger;
! }
! else
! return integer;
}
Index: TlsServerCertificate.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** TlsServerCertificate.cs 14 Dec 2003 15:01:54 -0000 1.15
--- TlsServerCertificate.cs 26 Dec 2003 11:17:14 -0000 1.16
***************
*** 143,147 ****
if (!certificate.IsCurrent)
{
! errors.Add(0x800B0101);
}
--- 143,148 ----
if (!certificate.IsCurrent)
{
! // errors.Add(0x800B0101);
! errors.Add(0x01);
}
***************
*** 160,174 ****
if (!this.checkDomainName(certificate.SubjectName))
{
! errors.Add(0x800B010F);
}
if (errors.Count > 0)
{
! int[] certificateErrors = new int[errors.Count];
!
! for (int i = 0; i < certificateErrors.Length; i++)
! {
! certificateErrors[i] = Convert.ToInt32(errors[i]);
! }
if (!this.Context.SslStream.RaiseServerCertificateValidation(
--- 161,171 ----
if (!this.checkDomainName(certificate.SubjectName))
{
! // errors.Add(0x800B010F);
! errors.Add(0x02);
}
if (errors.Count > 0)
{
! int[] certificateErrors = (int[])errors.ToArray(typeof(int));
if (!this.Context.SslStream.RaiseServerCertificateValidation(
Index: TlsServerKeyExchange.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** TlsServerKeyExchange.cs 21 Dec 2003 14:56:06 -0000 1.16
--- TlsServerKeyExchange.cs 26 Dec 2003 11:17:14 -0000 1.17
***************
*** 37,41 ****
private RSAParameters rsaParams;
private byte[] signedParams;
- private byte[] content;
#endregion
--- 37,40 ----
|