[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handsha
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos Guzm?n ?l. <car...@us...> - 2004-04-09 08:56:54
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv377 Modified Files: TlsClientCertificate.cs TlsClientCertificateVerify.cs Log Message: 2004-04-09 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/TlsClientSettings.cs: - Added new CertificateRSA property. * Mono.Security.Protocol.Tls/SslHandshakeHash.cs: - Added two new methods: CreateSignature and VerifySignature. * Mono.Security.Protocol.Tls.Handshake.Client/TlsCertificateVerify.cs: - Added Ssl3 implementation. * Mono.Security.Protocol.Tls.Handshake.Server/TlsCertificateVerify.cs: - Added initial implementation. Index: TlsClientCertificateVerify.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientCertificateVerify.cs 9 Mar 2004 22:04:55 -0000 1.4 --- TlsClientCertificateVerify.cs 9 Apr 2004 08:43:38 -0000 1.5 *************** *** 42,64 **** #endregion ! #region Methods ! public override void Update() { ! throw new NotSupportedException(); ! } ! #endregion ! #region Protected Methods ! protected override void ProcessAsSsl3() ! { ! throw new NotSupportedException(); } protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 42,89 ---- #endregion ! #region Protected Methods ! protected override void ProcessAsSsl3() { ! ServerContext context = (ServerContext)this.Context; ! byte[] signature = this.ReadBytes((int)this.Length); ! // Verify signature ! SslHandshakeHash hash = new SslHandshakeHash(context.MasterSecret); ! hash.TransformFinalBlock( ! context.HandshakeMessages.ToArray(), ! 0, ! (int)context.HandshakeMessages.Length); ! if (!hash.VerifySignature( ! context.ClientSettings.CertificateRSA, ! signature)) ! { ! context.RecordProtocol.SendAlert(AlertDescription.HandshakeFailiure); ! throw new TlsException("Handshake Failiure."); ! } } protected override void ProcessAsTls1() { ! ServerContext context = (ServerContext)this.Context; ! byte[] signature = this.ReadBytes((int)this.Length); ! ! // Verify signature ! MD5SHA1 hash = new MD5SHA1(); ! hash.ComputeHash( ! context.HandshakeMessages.ToArray(), ! 0, ! (int)context.HandshakeMessages.Length); ! ! if (!hash.VerifySignature( ! context.ClientSettings.CertificateRSA, ! signature)) ! { ! context.RecordProtocol.SendAlert(AlertDescription.HandshakeFailiure); ! ! throw new TlsException("Handshake Failiure."); ! } } Index: TlsClientCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientCertificate.cs 17 Mar 2004 16:33:36 -0000 1.4 --- TlsClientCertificate.cs 9 Apr 2004 08:43:37 -0000 1.5 *************** *** 67,71 **** this.clientCertificate = new X509Certificate(this.ReadBytes(length)); ! #warning "Is client certificate validation needed ??" } --- 67,80 ---- this.clientCertificate = new X509Certificate(this.ReadBytes(length)); ! this.validateCertificate(this.clientCertificate); ! } ! ! #endregion ! ! #region Private Methods ! ! private void validateCertificate(X509Certificate certificate) ! { ! #warning "Validate client certificate" } |