1 13 14 20 package org.ejbca.core.protocol; 21 22 import java.io.Serializable ; 23 24 import org.bouncycastle.asn1.DERBitString; 25 import org.bouncycastle.asn1.x509.ReasonFlags; 26 27 33 34 public class FailInfo implements Serializable { 35 36 39 public static final FailInfo BAD_ALGORITHM = new FailInfo(0); 40 41 44 public static final FailInfo BAD_MESSAGE_CHECK = new FailInfo(1); 45 46 49 public static final FailInfo BAD_REQUEST = new FailInfo(2); 50 51 54 public static final FailInfo BAD_TIME = new FailInfo(3); 55 56 59 public static final FailInfo BAD_CERTIFICATE_ID = new FailInfo(4); 60 63 public static final FailInfo WRONG_AUTHORITY = new FailInfo(6); 64 67 public static final FailInfo INCORRECT_DATA = new FailInfo(7); 68 71 public static final FailInfo BAD_POP = new FailInfo(9); 72 75 public static final FailInfo NOT_AUTHORIZED = new FailInfo(23); 76 79 private final int value; 80 81 private FailInfo(int value) { 82 this.value = value; 83 } 84 85 89 public String getValue() { 90 return Integer.toString(value); 91 } 92 93 97 public DERBitString getAsBitString() { 98 int i = 1 << value; 99 DERBitString str = new ReasonFlags(i); 101 return str; 102 } 103 104 public boolean equals(Object o) { 105 if (this == o) return true; 106 if (!(o instanceof FailInfo)) return false; 107 108 final FailInfo scepResponseStatus = (FailInfo) o; 109 110 if (value != scepResponseStatus.value) return false; 111 112 return true; 113 } 114 115 public int hashCode() { 116 return value; 117 } 118 public String toString() { 119 return Integer.toString(value); 120 } 121 } 122 | Popular Tags |