001: /*************************************************************************
002: * *
003: * EJBCA: The OpenSource Certificate Authority *
004: * *
005: * This software is free software; you can redistribute it and/or *
006: * modify it under the terms of the GNU Lesser General Public *
007: * License as published by the Free Software Foundation; either *
008: * version 2.1 of the License, or any later version. *
009: * *
010: * See terms of license at gnu.org. *
011: * *
012: *************************************************************************/package org.ejbca.core.model;
013:
014: /**
015: * Constants for users and certificates. Constants for Type of user: Type is constructed as a mask
016: * since one user can be of several types. To test a user type:
017: * <pre>
018: * if (((type & USER_ENDUSER) == USER_ENDUSER) && ((type & USER_CAADMIN) == USER_ADMINISTOR) || ...
019: * ...
020: * </pre>
021: * Bit usage: bits 0-7 (1:st byte): user types bits 8-15 (2:nd byte): unused bits 16-23 (3:rd
022: * byte): unused bits 24-30 (4:th byte): unused Constants for certificates are simple integer
023: * types. Constants for Token Types Token type is constructed of integer constants since only one
024: * token type can be generated.
025: *
026: * @version $Id: SecConst.java,v 1.9 2007/11/23 10:37:54 anatom Exp $
027: */
028: public class SecConst extends Object {
029: // User types
030:
031: /** Dummy type. */
032: public static final int USER_INVALID = 0x0;
033:
034: /** This is an end user certificate (default). */
035: public static final int USER_ENDUSER = 0x1;
036:
037: /** This user is an administrator. */
038: public static final int USER_ADMINISTRATOR = 0x40;
039:
040: /** This users keystores are key recoverable. */
041: public static final int USER_KEYRECOVERABLE = 0x80;
042:
043: /** Notification will be sent to this users emailaddress */
044: public static final int USER_SENDNOTIFICATION = 0x100;
045:
046: /** Registration data will be printed for this user */
047: public static final int USER_PRINT = 0x200;
048:
049: // Token types.
050:
051: /** Indicates that a browser generated token should be used. */
052: public static final int TOKEN_SOFT_BROWSERGEN = 1;
053:
054: /** Indicates that a p12 token should be generated. */
055: public static final int TOKEN_SOFT_P12 = 2;
056:
057: /** Indicates that a jks token should be generated. */
058: public static final int TOKEN_SOFT_JKS = 3;
059:
060: /** Indicates that a pem token should be generated. */
061: public static final int TOKEN_SOFT_PEM = 4;
062:
063: /** All values equal or below this constant should be treated as a soft token. */
064: public static final int TOKEN_SOFT = 100;
065:
066: public static final String[] TOKENTEXTS = { "TOKENSOFTBROWSERGEN",
067: "TOKENSOFTP12", "TOKENSOFTJKS", "TOKENSOFTPEM" };
068:
069: public static final int[] TOKENIDS = {
070: SecConst.TOKEN_SOFT_BROWSERGEN, SecConst.TOKEN_SOFT_P12,
071: SecConst.TOKEN_SOFT_JKS, SecConst.TOKEN_SOFT_PEM };
072:
073: /** Constant indicating a standard hard token, defined in scaper. */
074: public static final int TOKEN_HARD_DEFAULT = 101;
075:
076: /** Constant indicating a eid hard token.
077: * OBSERVE This class should only be used for backward compability with EJBCA 2.0
078: */
079: public static final int TOKEN_EID = 102;
080:
081: /**Constant indicating a swedish eid hard token. */
082: public static final int TOKEN_SWEDISHEID = 103;
083:
084: /**Constant indicating a enhanced eid hard token. */
085: public static final int TOKEN_ENHANCEDEID = 104;
086:
087: /**Constant indicating a enhanced eid hard token. */
088: public static final int TOKEN_TURKISHEID = 105;
089:
090: // Certificate profiles.
091:
092: public static final int NO_HARDTOKENISSUER = 0;
093:
094: public static final int CERTPROFILE_FIXED_ENDUSER = 1;
095: public static final int CERTPROFILE_FIXED_SUBCA = 2;
096: public static final int CERTPROFILE_FIXED_ROOTCA = 3;
097: public static final int CERTPROFILE_FIXED_OCSPSIGNER = 4;
098: public static final int CERTPROFILE_FIXED_HARDTOKENAUTH = 5;
099: public static final int CERTPROFILE_FIXED_HARDTOKENAUTHENC = 6;
100: public static final int CERTPROFILE_FIXED_HARDTOKENENC = 7;
101: public static final int CERTPROFILE_FIXED_HARDTOKENSIGN = 8;
102:
103: public static final int EMPTY_ENDENTITYPROFILE = 1;
104:
105: public static final int ALLCAS = 1;
106:
107: /**
108: * Constants defining range of id's reserved for fixed certificate types. Observe fixed
109: * certificates cannot have value 0.
110: */
111: public static final int FIXED_CERTIFICATEPROFILE_BOUNDRY = 1000;
112: public static final int PROFILE_NO_PROFILE = 0;
113:
114: /**
115: * Constants used in the RSASignSessionBean indicating the userdata defined CA should be used.
116: */
117: public static final int CAID_USEUSERDEFINED = 0;
118:
119: /** Constant used to determine the size of the result from SQL select queries */
120: public static final int MAXIMUM_QUERY_ROWCOUNT = 100;
121:
122: /** Constans used to indicate status of a CA. */
123: public static final int CA_ACTIVE = 1;
124: public static final int CA_WAITING_CERTIFICATE_RESPONSE = 2;
125: public static final int CA_EXPIRED = 3;
126: public static final int CA_REVOKED = 4;
127: public static final int CA_OFFLINE = 5;
128: public static final int CA_EXTERNAL = 6;
129:
130: /** signs certificates issued by the CA */
131: public static final int CAKEYPURPOSE_CERTSIGN = 1;
132: /** igns CRLs issues by the CA */
133: public static final int CAKEYPURPOSE_CRLSIGN = 2;
134: /** encrypts entity keys stored in the database for key recovery */
135: public static final int CAKEYPURPOSE_KEYENCRYPT = 3;
136: /** used for testing if the CA token is functioning and on-line */
137: public static final int CAKEYPURPOSE_KEYTEST = 4;
138: /** encrypts hard token PIN/PUK codes etc */
139: public static final int CAKEYPURPOSE_HARDTOKENENCRYPT = 5;
140:
141: /**
142: * Default key lengths. Users are allowed to choose from these key lengths when
143: * lookup of available bit lengths fails.
144: * @see org.ejbca.core.model.ApplyBean
145: */
146: public static final int[] DEFAULT_KEY_LENGTHS = new int[] { 512,
147: 1024, 2048 };
148:
149: /**
150: * Prevents creation of new SecConst
151: */
152: private SecConst() {
153: }
154: }
155:
156: // SecConst
|