コード例 #1
0
        /**
         * Terminate this connection with an alert.
         * <p/>
         * Can be used for normal closure too.
         *
         * @param alertLevel       The level of the alert, an be AlertLevel.fatal or AL_warning.
         * @param alertDescription The exact alert message.
         * @throws IOException If alert was fatal.
         */
        private void FailWithError(AlertLevel alertLevel, AlertDescription alertDescription)
        {
            /*
             * Check if the connection is still open.
             */
            if (!closed)
            {
                /*
                 * Prepare the message
                 */
                this.closed = true;

                if (alertLevel == AlertLevel.fatal)
                {
                    /*
                     * This is a fatal message.
                     */
                    this.failedWithError = true;
                }
                SendAlert(alertLevel, alertDescription);
                rs.Close();
                if (alertLevel == AlertLevel.fatal)
                {
                    throw new IOException(TLS_ERROR_MESSAGE);
                }
            }
            else
            {
                throw new IOException(TLS_ERROR_MESSAGE);
            }
        }
コード例 #2
0
        internal void SendAlert(AlertLevel alertLevel, AlertDescription alertDescription)
        {
            byte[] error = new byte[2];
            error[0] = (byte)alertLevel;
            error[1] = (byte)alertDescription;

            rs.WriteMessage(ContentType.alert, error, 0, 2);
        }
コード例 #3
0
 public static string GetText(byte alertDescription)
 {
     return(string.Concat(new object[]
     {
         AlertDescription.GetName(alertDescription),
         "(",
         alertDescription,
         ")"
     }));
 }
コード例 #4
0
        /**
        * Terminate this connection with an alert.
        * <p/>
        * Can be used for normal closure too.
        *
        * @param alertLevel       The level of the alert, an be AlertLevel.fatal or AL_warning.
        * @param alertDescription The exact alert message.
        * @throws IOException If alert was fatal.
        */
        private void FailWithError(AlertLevel alertLevel, AlertDescription	alertDescription)
        {
            /*
            * Check if the connection is still open.
            */
            if (!closed)
            {
                /*
                * Prepare the message
                */
                this.closed = true;

                if (alertLevel == AlertLevel.fatal)
                {
                    /*
                    * This is a fatal message.
                    */
                    this.failedWithError = true;
                }
                SendAlert(alertLevel, alertDescription);
                rs.Close();
                if (alertLevel == AlertLevel.fatal)
                {
                    throw new IOException(TLS_ERROR_MESSAGE);
                }
            }
            else
            {
                throw new IOException(TLS_ERROR_MESSAGE);
            }
        }
コード例 #5
0
        internal void SendAlert(AlertLevel alertLevel, AlertDescription alertDescription)
        {
            byte[] error = new byte[2];
            error[0] = (byte)alertLevel;
            error[1] = (byte)alertDescription;

            rs.WriteMessage(ContentType.alert, error, 0, 2);
        }
コード例 #6
0
ファイル: TlsFatalAlert.cs プロジェクト: htlp/itextsharp
		public TlsFatalAlert(AlertDescription alertDescription)
		{
			this.alertDescription = alertDescription;
		}
コード例 #7
0
 public TlsFatalAlert(AlertDescription alertDescription)
 {
     this.alertDescription = alertDescription;
 }
コード例 #8
0
 private void FailWithError(AlertDescription alertDescription, Exception ex)
 {
     this.FailWithError(AlertLevel.fatal, alertDescription, ex);
 }
コード例 #9
0
 /**
  * Terminate this connection with an alert.
  * <p/>
  * Can be used for normal closure too.
  *
  * @param alertLevel       The level of the alert, an be AlertLevel.fatal or AL_warning.
  * @param alertDescription The exact alert message.
  * @throws IOException If alert was fatal.
  */
 private void FailWithError(AlertLevel alertLevel, AlertDescription alertDescription)
 {
     this.FailWithError(alertLevel, alertDescription, null);
 }