KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > ca > certificateprofiles > HardTokenAuthEncCertificateProfile


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 package org.ejbca.core.model.ca.certificateprofiles;
15
16 import java.util.ArrayList JavaDoc;
17
18 /**
19  * HardTokenAuthEncCertificateProfile is a class defining the fixed characteristics
20  * of a hard token authentication and encryption certificate.
21  *
22  * @version $Id: HardTokenAuthEncCertificateProfile.java,v 1.3 2006/05/28 14:21:08 anatom Exp $
23  */

24 public class HardTokenAuthEncCertificateProfile extends CertificateProfile{
25
26     // Public Constants
27

28     public static final String JavaDoc CERTIFICATEPROFILENAME = "HARDTOKEN_AUTHENC";
29
30     // Public Methods
31
/** Creates a certificate with the characteristics of an end user.
32      * General options are set in the superclass's default contructor that is called automatically.
33      * You can override the general options by defining them again with different parameters here.
34      */

35     public HardTokenAuthEncCertificateProfile() {
36
37       setType(TYPE_ENDENTITY);
38
39       setUseKeyUsage(true);
40       setKeyUsage(new boolean[9]);
41       setKeyUsage(KEYENCIPHERMENT,true);
42       setKeyUsage(DIGITALSIGNATURE,true);
43       setKeyUsageCritical(true);
44
45       setUseExtendedKeyUsage(true);
46       ArrayList JavaDoc eku = new ArrayList JavaDoc();
47       eku.add(new Integer JavaDoc(CLIENTAUTH));
48       eku.add(new Integer JavaDoc(EMAILPROTECTION));
49       eku.add(new Integer JavaDoc(SMARTCARDLOGON));
50       eku.add(new Integer JavaDoc(IPSECUSER));
51       setExtendedKeyUsage(eku);
52       setExtendedKeyUsageCritical(false);
53       
54     }
55
56     // Public Methods.
57
public void upgrade(){
58         if(Float.compare(LATEST_VERSION, getVersion()) != 0) {
59             // New version of the class, upgrade
60

61             super.upgrade();
62         }
63     }
64
65
66     // Private fields.
67
}
68
Popular Tags