001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package org.apache.geronimo.util.asn1.x509;
019    
020    import org.apache.geronimo.util.asn1.DERBitString;
021    
022    /**
023     * The ReasonFlags object.
024     * <pre>
025     * ReasonFlags ::= BIT STRING {
026     *      unused                  (0),
027     *      keyCompromise           (1),
028     *      cACompromise            (2),
029     *      affiliationChanged      (3),
030     *      superseded              (4),
031     *      cessationOfOperation    (5),
032     *      certificateHold         (6),
033     *      privilegeWithdrawn      (7),
034     *      aACompromise            (8) }
035     * </pre>
036     */
037    public class ReasonFlags
038        extends DERBitString
039    {
040        /**
041         * @deprecated use lower case version
042         */
043        public static final int UNUSED                  = (1 << 7);
044        /**
045         * @deprecated use lower case version
046         */
047        public static final int KEY_COMPROMISE          = (1 << 6);
048        /**
049         * @deprecated use lower case version
050         */
051        public static final int CA_COMPROMISE           = (1 << 5);
052        /**
053         * @deprecated use lower case version
054         */
055        public static final int AFFILIATION_CHANGED     = (1 << 4);
056        /**
057         * @deprecated use lower case version
058         */
059        public static final int SUPERSEDED              = (1 << 3);
060        /**
061         * @deprecated use lower case version
062         */
063        public static final int CESSATION_OF_OPERATION  = (1 << 2);
064        /**
065         * @deprecated use lower case version
066         */
067        public static final int CERTIFICATE_HOLD        = (1 << 1);
068        /**
069         * @deprecated use lower case version
070         */
071        public static final int PRIVILEGE_WITHDRAWN     = (1 << 0);
072        /**
073         * @deprecated use lower case version
074         */
075        public static final int AA_COMPROMISE           = (1 << 15);
076    
077        public static final int unused                  = (1 << 7);
078        public static final int keyCompromise           = (1 << 6);
079        public static final int cACompromise            = (1 << 5);
080        public static final int affiliationChanged      = (1 << 4);
081        public static final int superseded              = (1 << 3);
082        public static final int cessationOfOperation    = (1 << 2);
083        public static final int certificateHold         = (1 << 1);
084        public static final int privilegeWithdrawn      = (1 << 0);
085        public static final int aACompromise            = (1 << 15);
086    
087        /**
088         * @param reasons - the bitwise OR of the Key Reason flags giving the
089         * allowed uses for the key.
090         */
091        public ReasonFlags(
092            int reasons)
093        {
094            super(getBytes(reasons), getPadBits(reasons));
095        }
096    
097        public ReasonFlags(
098            DERBitString reasons)
099        {
100            super(reasons.getBytes(), reasons.getPadBits());
101        }
102    }