[pgsqlclient-checkins] pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts TlsAlert.cs,1.1,1.2 Tls
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-08-26 09:38:16
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts In directory sc8-pr-cvs1:/tmp/cvs-serv14857 Modified Files: TlsAlert.cs TlsCloseNotifyAlert.cs TlsWarningAlertEventArgs.cs Log Message: Simplified exception handling Index: TlsAlert.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts/TlsAlert.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsAlert.cs 20 Aug 2003 11:49:27 -0000 1.1 --- TlsAlert.cs 25 Aug 2003 10:22:36 -0000 1.2 *************** *** 109,112 **** --- 109,194 ---- #endregion + + #region STATIC_METHODS + + internal static string GetAlertMessage(TlsAlertDescription description) + { + switch (description) + { + case TlsAlertDescription.AccessDenied: + return "An inappropriate message was received."; + + case TlsAlertDescription.BadCertificate: + return "TLSCiphertext decrypted in an invalid way."; + + case TlsAlertDescription.BadRecordMAC: + return "Record with an incorrect MAC."; + + case TlsAlertDescription.CertificateExpired: + return "Certificate has expired or is not currently valid"; + + case TlsAlertDescription.CertificateRevoked: + return "Certificate was revoked by its signer."; + + case TlsAlertDescription.CertificateUnknown: + return "Certificate Unknown."; + + case TlsAlertDescription.CloseNotify: + return "Connection closed"; + + case TlsAlertDescription.DecodeError: + return "A message could not be decoded because some field was out of the specified range or the length of the message was incorrect."; + + case TlsAlertDescription.DecompressionFailiure: + return "The decompression function received improper input (e.g. data that would expand to excessive length)."; + + case TlsAlertDescription.DecryptError: + return "TLSCiphertext decrypted in an invalid way: either it wasn`t an even multiple of the block length or its padding values, when checked, weren`t correct."; + + case TlsAlertDescription.DecryptionFailed: + return "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message."; + + case TlsAlertDescription.ExportRestriction: + return "Negotiation not in compliance with export restrictions was detected."; + + case TlsAlertDescription.HandshakeFailiure: + return "Unable to negotiate an acceptable set of security parameters given the options available."; + + case TlsAlertDescription.IlegalParameter: + return "A field in the handshake was out of range or inconsistent with other fields."; + + case TlsAlertDescription.InsuficientSecurity: + return "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client."; + + case TlsAlertDescription.InternalError: + return "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue."; + + case TlsAlertDescription.NoRenegotiation: + return "Invalid renegotiation."; + + case TlsAlertDescription.ProtocolVersion: + return "Unsupported protocol version."; + + case TlsAlertDescription.RecordOverflow: + return "Invalid length on TLSCiphertext record or TLSCompressed record."; + + case TlsAlertDescription.UnexpectedMessage: + return "Invalid message receive."; + + case TlsAlertDescription.UnknownCA: + return "CA can't be identified as a trusted CA."; + + case TlsAlertDescription.UnsupportedCertificate: + return "Certificate was of an unsupported type."; + + case TlsAlertDescription.UserCancelled: + return "Handshake cancelled by user."; + + default: + return ""; + } + } + + #endregion } } Index: TlsCloseNotifyAlert.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts/TlsCloseNotifyAlert.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCloseNotifyAlert.cs 20 Aug 2003 11:49:27 -0000 1.1 --- TlsCloseNotifyAlert.cs 25 Aug 2003 10:22:36 -0000 1.2 *************** *** 34,38 **** public override void UpdateSession() { ! this.Session.State.ClientConnectionEnd = true; } } --- 34,38 ---- public override void UpdateSession() { ! this.Session.State.ConnectionEnd = true; } } Index: TlsWarningAlertEventArgs.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/Alerts/TlsWarningAlertEventArgs.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsWarningAlertEventArgs.cs 20 Aug 2003 11:49:27 -0000 1.1 --- TlsWarningAlertEventArgs.cs 25 Aug 2003 10:22:36 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- private TlsAlertLevel level; private TlsAlertDescription description; + private string message; #endregion *************** *** 39,47 **** } ! private TlsAlertDescription Description { get { return description; } } #endregion --- 40,53 ---- } ! public TlsAlertDescription Description { get { return description; } } + public string Message + { + get { return message; } + } + #endregion *************** *** 52,55 **** --- 58,62 ---- this.level = level; this.description = description; + this.message = TlsAlert.GetAlertMessage(description); } |