View Javadoc

1   /**
2    *
3    *  Licensed to the Apache Software Foundation (ASF) under one or more
4    *  contributor license agreements.  See the NOTICE file distributed with
5    *  this work for additional information regarding copyright ownership.
6    *  The ASF licenses this file to You under the Apache License, Version 2.0
7    *  (the "License"); you may not use this file except in compliance with
8    *  the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing, software
13   *  distributed under the License is distributed on an "AS IS" BASIS,
14   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *  See the License for the specific language governing permissions and
16   *  limitations under the License.
17   */
18  
19  package org.apache.geronimo.util.asn1.x509;
20  
21  import org.apache.geronimo.util.asn1.DERBitString;
22  
23  /**
24   * The ReasonFlags object.
25   * <pre>
26   * ReasonFlags ::= BIT STRING {
27   *      unused                  (0),
28   *      keyCompromise           (1),
29   *      cACompromise            (2),
30   *      affiliationChanged      (3),
31   *      superseded              (4),
32   *      cessationOfOperation    (5),
33   *      certificateHold         (6),
34   *      privilegeWithdrawn      (7),
35   *      aACompromise            (8) }
36   * </pre>
37   */
38  public class ReasonFlags
39      extends DERBitString
40  {
41      /**
42       * @deprecated use lower case version
43       */
44      public static final int UNUSED                  = (1 << 7);
45      /**
46       * @deprecated use lower case version
47       */
48      public static final int KEY_COMPROMISE          = (1 << 6);
49      /**
50       * @deprecated use lower case version
51       */
52      public static final int CA_COMPROMISE           = (1 << 5);
53      /**
54       * @deprecated use lower case version
55       */
56      public static final int AFFILIATION_CHANGED     = (1 << 4);
57      /**
58       * @deprecated use lower case version
59       */
60      public static final int SUPERSEDED              = (1 << 3);
61      /**
62       * @deprecated use lower case version
63       */
64      public static final int CESSATION_OF_OPERATION  = (1 << 2);
65      /**
66       * @deprecated use lower case version
67       */
68      public static final int CERTIFICATE_HOLD        = (1 << 1);
69      /**
70       * @deprecated use lower case version
71       */
72      public static final int PRIVILEGE_WITHDRAWN     = (1 << 0);
73      /**
74       * @deprecated use lower case version
75       */
76      public static final int AA_COMPROMISE           = (1 << 15);
77  
78      public static final int unused                  = (1 << 7);
79      public static final int keyCompromise           = (1 << 6);
80      public static final int cACompromise            = (1 << 5);
81      public static final int affiliationChanged      = (1 << 4);
82      public static final int superseded              = (1 << 3);
83      public static final int cessationOfOperation    = (1 << 2);
84      public static final int certificateHold         = (1 << 1);
85      public static final int privilegeWithdrawn      = (1 << 0);
86      public static final int aACompromise            = (1 << 15);
87  
88      /**
89       * @param reasons - the bitwise OR of the Key Reason flags giving the
90       * allowed uses for the key.
91       */
92      public ReasonFlags(
93          int reasons)
94      {
95          super(getBytes(reasons), getPadBits(reasons));
96      }
97  
98      public ReasonFlags(
99          DERBitString reasons)
100     {
101         super(reasons.getBytes(), reasons.getPadBits());
102     }
103 }