⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sslexception.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
/*
 *  SSL-Explorer
 *
 *  Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2 of
 *  the License, or (at your option) any later version.
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
			
package com.maverick.ssl;

/**
 * An exception thrown by the API
 *
 * @author Lee David Painter
 * @version $Revision: 1.3 $
 */
public class SSLException extends Exception {

  /**
   * Status codes defined by the specification
   */
  public static final int CLOSE_NOTIFY = 0;
  public static final int UNEXPECTED_MESSAGE = 10;
  public static final int BAD_RECORD_MAC = 20;
  public static final int DECOMPRESSION_FAILURE = 30;
  public static final int HANDSHAKE_FAILURE = 40;
  public static final int NO_CERTIFICATE = 41;
  public static final int BAD_CERTIFICATE = 42;
  public static final int UNSUPPORTED_CERTIFICATE = 43;
  public static final int CERTIFICATE_REVOKED = 44;
  public static final int CERTIFICATE_EXPIRED = 45;
  public static final int CERTIFICATE_UNKNOWN = 46;

  /**
   * Maverick SSL status codes
   */
  public static final int PROTOCOL_VIOLATION = 999;
  public static final int UNSUPPORTED_OPERATION = 998;
  public static final int INTERNAL_ERROR = 997;
  public static final int UNEXPECTED_TERMINATION = 996;
  public static final int READ_TIMEOUT = 997;

  int status;

  public SSLException(int status) {
    super(getDescription(status));
    this.status = status;
  }

  public SSLException(int status, String msg) {
    super(msg);
    this.status = status;
  }

  public int getStatus() {
    return status;
  }

  public static String getDescription(int status) {
    switch(status) {
      case CLOSE_NOTIFY:
        return "The remote side has closed the connection";
      case UNEXPECTED_MESSAGE:
        return "Unexpected message";
      case BAD_RECORD_MAC:
        return "Bad record MAC";
      case DECOMPRESSION_FAILURE:
        return "Decompression failure";
      case HANDSHAKE_FAILURE:
        return "Handshake failure";
      case NO_CERTIFICATE:
        return "No certificate";
      case BAD_CERTIFICATE:
        return "Bad certificate";
      case UNSUPPORTED_CERTIFICATE:
        return "Unsupported certificate";
      case CERTIFICATE_REVOKED:
        return "Certificate revoked";
      case CERTIFICATE_EXPIRED:
        return "Certificate expired";
      case CERTIFICATE_UNKNOWN:
        return "Certificate unknown";
      case PROTOCOL_VIOLATION:
        return "Protocol violation";
      case READ_TIMEOUT:
        return "Read timeout";
      default:
        return "Unexpected error status " + status;

    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -