1 13 14 package org.ejbca.core.model.hardtoken.profiles; 15 16 17 import java.util.ArrayList ; 18 19 import org.ejbca.core.model.SecConst; 20 21 22 23 28 public class TurkishEIDProfile extends EIDProfile { 29 30 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 static final int NUMBEROFCERTIFICATES = 2; 42 protected static final int NUMBEROFPINS = 1; 43 44 45 public static final int[] AVAILABLEMINIMUMKEYLENGTHS = {1024, 2048}; 47 48 49 51 52 53 54 public TurkishEIDProfile() { 56 super(); 57 58 data.put(TYPE, new Integer (TYPE_TURKISHEID)); 59 60 ArrayList certprofileids = new ArrayList (NUMBEROFCERTIFICATES); 61 certprofileids.add(new Integer (SecConst.CERTPROFILE_FIXED_HARDTOKENSIGN)); 62 certprofileids.add(new Integer (SecConst.CERTPROFILE_FIXED_HARDTOKENAUTHENC)); 63 data.put(CERTIFICATEPROFILEID, certprofileids); 64 65 ArrayList certWritable = new ArrayList (NUMBEROFCERTIFICATES); 66 certWritable.add(Boolean.FALSE); 67 certWritable.add(Boolean.FALSE); 68 data.put(CERTWRITABLE, certWritable); 69 70 ArrayList caids = new ArrayList (NUMBEROFCERTIFICATES); 71 caids.add(new Integer (CAID_USEUSERDEFINED)); 72 caids.add(new Integer (CAID_USEUSERDEFINED)); 73 data.put(CAID, caids); 74 75 ArrayList pintypes = new ArrayList (NUMBEROFPINS); 76 pintypes.add(new Integer (PINTYPE_ASCII_NUMERIC)); 77 data.put(PINTYPE, pintypes); 78 79 ArrayList minpinlength = new ArrayList (NUMBEROFPINS); 80 minpinlength.add(new Integer (4)); 81 data.put(MINIMUMPINLENGTH, minpinlength); 82 83 ArrayList iskeyrecoverable = new ArrayList (NUMBEROFCERTIFICATES); 84 iskeyrecoverable.add(new Boolean (false)); 85 iskeyrecoverable.add(new Boolean (false)); 86 data.put(ISKEYRECOVERABLE, iskeyrecoverable); 87 88 89 ArrayList reuseoldcertificate = new ArrayList (NUMBEROFCERTIFICATES); 90 reuseoldcertificate.add(Boolean.FALSE); 91 reuseoldcertificate.add(Boolean.FALSE); 92 data.put(REUSEOLDCERTIFICATE, reuseoldcertificate); 93 94 ArrayList minimumkeylength = new ArrayList (NUMBEROFCERTIFICATES); 95 minimumkeylength.add(new Integer (1024)); 96 minimumkeylength.add(new Integer (1024)); 97 data.put(MINIMUMKEYLENGTH, minimumkeylength); 98 99 ArrayList keytypes = new ArrayList (NUMBEROFCERTIFICATES); 100 keytypes.add(KEYTYPE_RSA); 101 keytypes.add(KEYTYPE_RSA); 102 data.put(KEYTYPES, keytypes); 103 104 } 106 107 108 109 public int[] getAvailableMinimumKeyLengths(){ 110 return AVAILABLEMINIMUMKEYLENGTHS; 111 } 112 113 114 118 public boolean isTokenSupported(String tokenidentificationstring) { 119 return false; 120 } 121 122 123 124 127 public Object clone() throws CloneNotSupportedException { 128 TurkishEIDProfile clone = new TurkishEIDProfile(); 129 super.clone(clone); 130 131 return clone; 132 } 133 134 137 public float getLatestVersion() { 138 return LATEST_VERSION; 139 } 140 141 public void upgrade(){ 142 if(Float.compare(LATEST_VERSION, getVersion()) != 0) { 143 super.upgrade(); 145 146 147 148 data.put(VERSION, new Float (LATEST_VERSION)); 149 } 150 } 151 } 152 | Popular Tags |