01: /*************************************************************************
02: * *
03: * EJBCA: The OpenSource Certificate Authority *
04: * *
05: * This software is free software; you can redistribute it and/or *
06: * modify it under the terms of the GNU Lesser General Public *
07: * License as published by the Free Software Foundation; either *
08: * version 2.1 of the License, or any later version. *
09: * *
10: * See terms of license at gnu.org. *
11: * *
12: *************************************************************************/package org.ejbca.core.model.ca.certificateprofiles;
13:
14: import java.util.ArrayList;
15:
16: /**
17: * EndUserCertificateProfile is a class defining the fixed characteristics of an enduser certificate type
18: *
19: * @version $Id: EndUserCertificateProfile.java,v 1.4 2008/03/14 17:00:16 anatom Exp $
20: */
21: public class EndUserCertificateProfile extends CertificateProfile {
22:
23: // Public Constants
24:
25: public static final String CERTIFICATEPROFILENAME = "ENDUSER";
26:
27: // Public Methods
28: /** Creates a certificate with the characteristics of an end user.
29: * General options are set in the superclass's default contructor that is called automatically.
30: * You can override the general options by defining them again with different parameters here.
31: */
32: public EndUserCertificateProfile() {
33:
34: setType(TYPE_ENDENTITY);
35:
36: // Standard key usages for end users are: digitalSignature | keyEncipherment or nonRepudiation
37: // Default key usage is digitalSignature | keyEncipherment
38: // Create an array for KeyUsage acoording to X509Certificate.getKeyUsage()
39: setUseKeyUsage(true);
40: setKeyUsage(new boolean[9]);
41: setKeyUsage(DIGITALSIGNATURE, true);
42: setKeyUsage(KEYENCIPHERMENT, true);
43: setKeyUsageCritical(true);
44:
45: setUseExtendedKeyUsage(true);
46: ArrayList eku = new ArrayList();
47: eku.add(new Integer(SERVERAUTH));
48: eku.add(new Integer(CLIENTAUTH));
49: eku.add(new Integer(EMAILPROTECTION));
50: setExtendedKeyUsage(eku);
51: setExtendedKeyUsageCritical(false);
52:
53: }
54:
55: // Public Methods.
56: public void upgrade() {
57: if (Float.compare(LATEST_VERSION, getVersion()) != 0) {
58: // New version of the class, upgrade
59: super .upgrade();
60: }
61: }
62:
63: // Private fields.
64:
65: }
|