[pgsqlclient-checkins] pgsqlclient_10/PgSqlClient.Security.Tls/source TlsReader.cs,1.5,1.6
Status: Inactive
Brought to you by:
carlosga_fb
|
From: <car...@us...> - 2003-08-26 09:38:15
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source
In directory sc8-pr-cvs1:/tmp/cvs-serv14793
Modified Files:
TlsReader.cs
Log Message:
Simplified exception handling
Index: TlsReader.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsReader.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TlsReader.cs 24 Aug 2003 21:08:07 -0000 1.5
--- TlsReader.cs 25 Aug 2003 10:22:03 -0000 1.6
***************
*** 140,297 ****
{
case TlsAlertLevel.Fatal:
! switch (alertDesc)
! {
! case TlsAlertDescription.AccessDenied:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "An inappropriate message was received.");
!
! case TlsAlertDescription.BadCertificate:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "TLSCiphertext decrypted in an invalid way.");
!
! case TlsAlertDescription.BadRecordMAC:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Record with an incorrect MAC.");
!
! case TlsAlertDescription.CertificateExpired:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Certificate has expired or is not currently valid");
!
! case TlsAlertDescription.CertificateRevoked:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Certificate was revoked by its signer.");
!
! case TlsAlertDescription.CertificateUnknown:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Certificate Unknown.");
!
! case TlsAlertDescription.CloseNotify:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "");
!
! case TlsAlertDescription.DecodeError:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "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:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "The decompression function received improper input (e.g. data that would expand to excessive length).");
!
! case TlsAlertDescription.DecryptError:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "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:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message.");
!
! case TlsAlertDescription.ExportRestriction:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Negotiation not in compliance with export restrictions was detected.");
!
! case TlsAlertDescription.HandshakeFailiure:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Unable to negotiate an acceptable set of security parameters given the options available.");
!
! case TlsAlertDescription.IlegalParameter:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "A field in the handshake was out of range or inconsistent with other fields");
!
! case TlsAlertDescription.InsuficientSecurity:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client.");
!
! case TlsAlertDescription.InternalError:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue.");
!
! case TlsAlertDescription.NoRenegotiation:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Invalid renegotiation.");
!
! case TlsAlertDescription.ProtocolVersion:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Unsupported protocol version.");
!
! case TlsAlertDescription.RecordOverflow:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Invalid length on TLSCiphertext record or TLSCompressed record.");
!
! case TlsAlertDescription.UnexpectedMessage:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Invalid message receive.");
!
! case TlsAlertDescription.UnknownCA:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "CA can't be identified as a trusted CA.");
!
! case TlsAlertDescription.UnsupportedCertificate:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Certificate was of an unsupported type.");
!
! case TlsAlertDescription.UserCancelled:
! throw new TlsException(
! alertLevel,
! alertDesc,
! "Handshake cancelled by user.");
! }
! break;
case TlsAlertLevel.Warning:
default:
! switch (alertDesc)
! {
! case TlsAlertDescription.CloseNotify:
! session.State.ConnectionEnd = true;
! break;
! default:
! session.RaiseWarningAlert(alertLevel, alertDesc);
! break;
! }
break;
}
--- 140,160 ----
{
case TlsAlertLevel.Fatal:
! throw new TlsException(
! alertLevel,
! alertDesc,
! TlsAlert.GetAlertMessage(alertDesc));
case TlsAlertLevel.Warning:
default:
! switch (alertDesc)
! {
! case TlsAlertDescription.CloseNotify:
! session.State.ConnectionEnd = true;
! break;
! default:
! session.RaiseWarningAlert(alertLevel, alertDesc);
! break;
! }
break;
}
|