* @throws Exception
*/
private void createAdminTokenEndEntityProfile(int caid) throws Exception {
int tokenid = ejb.getHardTokenSession().getHardTokenProfileId(getAdmin(), ADMINTOKENPROFILENAME);
int hardtokenissuerid = ejb.getHardTokenSession().getHardTokenIssuerId(getAdmin(), ISSUERALIAS);
EndEntityProfile profile = new EndEntityProfile();
// Set autogenerated password
profile.setUse(EndEntityProfile.PASSWORD, 0, false);
// Batch
profile.setUse(EndEntityProfile.CLEARTEXTPASSWORD, 0, true);
profile.setRequired(EndEntityProfile.CLEARTEXTPASSWORD, 0, true);
profile.setValue(EndEntityProfile.CLEARTEXTPASSWORD, 0, EndEntityProfile.TRUE);
// Set CA
profile.setValue(EndEntityProfile.DEFAULTCA, 0, "" + caid);
profile.setValue(EndEntityProfile.AVAILCAS, 0, "" + caid);
profile.setValue(EndEntityProfile.DEFAULTCERTPROFILE, 0, "" + SecConst.CERTPROFILE_FIXED_ENDUSER);
profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, "" + SecConst.CERTPROFILE_FIXED_ENDUSER + ";" + SecConst.CERTPROFILE_FIXED_HARDTOKENAUTH + ";"
+ SecConst.CERTPROFILE_FIXED_HARDTOKENAUTHENC + ";" + SecConst.CERTPROFILE_FIXED_HARDTOKENSIGN + ";" + SecConst.CERTPROFILE_FIXED_HARDTOKENENC);
// Set Default Token Type
profile.setValue(EndEntityProfile.DEFKEYSTORE, 0, "" + tokenid);
profile.setValue(EndEntityProfile.AVAILKEYSTORE, 0, "" + tokenid);
// Set Default Issuers
profile.setUse(EndEntityProfile.AVAILTOKENISSUER, 0, true);
profile.setValue(EndEntityProfile.DEFAULTTOKENISSUER, 0, "" + hardtokenissuerid);
profile.setValue(EndEntityProfile.AVAILTOKENISSUER, 0, "" + hardtokenissuerid);
// Save Profile
this.ejb.getEndEntityProfileSession().addEndEntityProfile(getAdmin(), ADMINTOKENENDENTITYPROFILE, profile);
}