home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / sun / security / x509 / CertException.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  2.0 KB  |  62 lines

  1. package sun.security.x509;
  2.  
  3. public class CertException extends SecurityException {
  4.    public static final int verf_INVALID_SIG = 1;
  5.    public static final int verf_INVALID_REVOKED = 2;
  6.    public static final int verf_INVALID_NOTBEFORE = 3;
  7.    public static final int verf_INVALID_EXPIRED = 4;
  8.    public static final int verf_CA_UNTRUSTED = 5;
  9.    public static final int verf_CHAIN_LENGTH = 6;
  10.    public static final int verf_PARSE_ERROR = 7;
  11.    public static final int err_CONSTRUCTION = 8;
  12.    public static final int err_INVALID_PUBLIC_KEY = 9;
  13.    private int verfCode;
  14.    private String moreData;
  15.  
  16.    public CertException(int var1, String var2) {
  17.       this.verfCode = var1;
  18.       this.moreData = var2;
  19.    }
  20.  
  21.    public CertException(int var1) {
  22.       this.verfCode = var1;
  23.    }
  24.  
  25.    public int getVerfCode() {
  26.       return this.verfCode;
  27.    }
  28.  
  29.    public String getMoreData() {
  30.       return this.moreData;
  31.    }
  32.  
  33.    public String getVerfDescription() {
  34.       switch (this.verfCode) {
  35.          case 1:
  36.             return "The signature in the certificate is not valid.";
  37.          case 2:
  38.             return "The certificate was revoked.";
  39.          case 3:
  40.             return "The certificate is not yet valid.";
  41.          case 4:
  42.             return "The certificate expired.";
  43.          case 5:
  44.             return "The Authority which issued the is not trusted.";
  45.          case 6:
  46.             return "The certificate path to a trusted authority is too long.";
  47.          case 7:
  48.             return "The certificate could not be parsed.";
  49.          case 8:
  50.             return "There was an error when constructing the certificate.";
  51.          case 9:
  52.             return "The public key was not in the correct format.";
  53.          default:
  54.             return "Unknown code:  " + this.verfCode;
  55.       }
  56.    }
  57.  
  58.    public String toString() {
  59.       return "[Certificate Exception:  " + this.getVerfDescription() + (this.moreData != null ? "\n  (" + this.moreData + ")" : "") + "]";
  60.    }
  61. }
  62.