KickJava   Java API By Example, From Geeks To Geeks.

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


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  * HardTokenAuthCertificateProfile is a class defining the fixed characteristics
20  * of a hard token authentication certificate.
21  *
22  * @version $Id: HardTokenAuthCertificateProfile.java,v 1.3 2006/05/28 14:21:08 anatom Exp $
23  */

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

28     public static final String JavaDoc CERTIFICATEPROFILENAME = "HARDTOKEN_AUTH";
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 HardTokenAuthCertificateProfile() {
36
37       setType(TYPE_ENDENTITY);
38
39       setUseKeyUsage(true);
40       setKeyUsage(new boolean[9]);
41       setKeyUsage(DIGITALSIGNATURE,true);
42       setKeyUsageCritical(true);
43
44       setUseExtendedKeyUsage(true);
45       ArrayList JavaDoc eku = new ArrayList JavaDoc();
46       eku.add(new Integer JavaDoc(CLIENTAUTH));
47       eku.add(new Integer JavaDoc(IPSECUSER));
48       eku.add(new Integer JavaDoc(SMARTCARDLOGON));
49       setExtendedKeyUsage(eku);
50       setExtendedKeyUsageCritical(false);
51       
52     }
53
54     // Public Methods.
55
public void upgrade(){
56         if(Float.compare(LATEST_VERSION, getVersion()) != 0) {
57             // New version of the class, upgrade
58

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