KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > hardtoken > profiles > TurkishEIDProfile


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.hardtoken.profiles;
15
16
17 import java.util.ArrayList JavaDoc;
18
19 import org.ejbca.core.model.SecConst;
20
21
22
23 /**
24  * Hard token profile with a goal to fulfill Swedish EID standard.
25  *
26  * @version $Id: TurkishEIDProfile.java,v 1.2 2006/11/11 12:46:04 herrvendil Exp $
27  */

28 public class TurkishEIDProfile extends EIDProfile {
29         
30     // Public Constants
31
public static final int TYPE_TURKISHEID = 3;
32     
33     public static final float LATEST_VERSION = 1;
34
35     public static final int CERTUSAGE_SIGN = 0;
36     public static final int CERTUSAGE_AUTHENC = 1;
37     
38             
39     
40     // Protected Constants
41
protected static final int NUMBEROFCERTIFICATES = 2;
42     protected static final int NUMBEROFPINS = 1;
43     
44     
45     // Private Constants
46
public static final int[] AVAILABLEMINIMUMKEYLENGTHS = {1024, 2048};
47         
48     
49     // Protected Fields
50

51     
52     
53     
54     // Default Values
55
public TurkishEIDProfile() {
56       super();
57       
58       data.put(TYPE, new Integer JavaDoc(TYPE_TURKISHEID));
59       
60       ArrayList JavaDoc certprofileids = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
61       certprofileids.add(new Integer JavaDoc(SecConst.CERTPROFILE_FIXED_HARDTOKENSIGN));
62       certprofileids.add(new Integer JavaDoc(SecConst.CERTPROFILE_FIXED_HARDTOKENAUTHENC));
63       data.put(CERTIFICATEPROFILEID, certprofileids);
64       
65       ArrayList JavaDoc certWritable = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
66       certWritable.add(Boolean.FALSE);
67       certWritable.add(Boolean.FALSE);
68       data.put(CERTWRITABLE, certWritable);
69       
70       ArrayList JavaDoc caids = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
71       caids.add(new Integer JavaDoc(CAID_USEUSERDEFINED));
72       caids.add(new Integer JavaDoc(CAID_USEUSERDEFINED));
73       data.put(CAID, caids);
74       
75       ArrayList JavaDoc pintypes = new ArrayList JavaDoc(NUMBEROFPINS);
76       pintypes.add(new Integer JavaDoc(PINTYPE_ASCII_NUMERIC));
77       data.put(PINTYPE, pintypes);
78
79       ArrayList JavaDoc minpinlength = new ArrayList JavaDoc(NUMBEROFPINS);
80       minpinlength.add(new Integer JavaDoc(4));
81       data.put(MINIMUMPINLENGTH, minpinlength);
82       
83       ArrayList JavaDoc iskeyrecoverable = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
84       iskeyrecoverable.add(new Boolean JavaDoc(false));
85       iskeyrecoverable.add(new Boolean JavaDoc(false));
86       data.put(ISKEYRECOVERABLE, iskeyrecoverable);
87       
88         
89       ArrayList JavaDoc reuseoldcertificate = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
90       reuseoldcertificate.add(Boolean.FALSE);
91       reuseoldcertificate.add(Boolean.FALSE);
92       data.put(REUSEOLDCERTIFICATE, reuseoldcertificate);
93
94       ArrayList JavaDoc minimumkeylength = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
95       minimumkeylength.add(new Integer JavaDoc(1024));
96       minimumkeylength.add(new Integer JavaDoc(1024));
97       data.put(MINIMUMKEYLENGTH, minimumkeylength);
98
99       ArrayList JavaDoc keytypes = new ArrayList JavaDoc(NUMBEROFCERTIFICATES);
100       keytypes.add(KEYTYPE_RSA);
101       keytypes.add(KEYTYPE_RSA);
102       data.put(KEYTYPES, keytypes);
103       
104       // HERE
105
}
106
107
108     
109     public int[] getAvailableMinimumKeyLengths(){
110         return AVAILABLEMINIMUMKEYLENGTHS;
111     }
112                             
113
114     /**
115      * @deprecated
116      * @see org.ejbca.core.model.hardtoken.hardtokenprofiles.HardTokenProfile#isTokenSupported(java.lang.String)
117      */

118     public boolean isTokenSupported(String JavaDoc tokenidentificationstring) {
119         return false;
120     }
121
122
123
124     /*
125      * @see org.ejbca.core.model.hardtoken.hardtokenprofiles.HardTokenProfile#clone()
126      */

127     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
128         TurkishEIDProfile clone = new TurkishEIDProfile();
129         super.clone(clone);
130
131         return clone;
132     }
133
134     /*
135      * @see org.ejbca.core.model.hardtoken.hardtokenprofiles.HardTokenProfile#getLatestVersion()
136      */

137     public float getLatestVersion() {
138       return LATEST_VERSION;
139     }
140
141     public void upgrade(){
142         if(Float.compare(LATEST_VERSION, getVersion()) != 0) {
143             // New version of the class, upgrade
144
super.upgrade();
145             
146
147             
148             data.put(VERSION, new Float JavaDoc(LATEST_VERSION));
149         }
150     }
151 }
152
Popular Tags