Package org.ejbca.core.model.ra.raadmin

Examples of org.ejbca.core.model.ra.raadmin.EndEntityProfile


     * @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);
    }
View Full Code Here


        userdata.setCertificateProfileId(newCertProfileId);
        userAdminSession.changeUser(admin, userdata, true);
    }

    private int createEndEntityProfile(Admin admin, String endEntityProfileName, int[] certProfiles) throws EndEntityProfileExistsException {
        EndEntityProfile profile;
        endEntityProfileSession.removeEndEntityProfile(admin, endEntityProfileName);

        StringBuilder availableCertProfiles = new StringBuilder();
        for (int id : certProfiles) {
            availableCertProfiles.append(id);
            availableCertProfiles.append(EndEntityProfile.SPLITCHAR);
        }

        profile = new EndEntityProfile();
        profile.setUse(EndEntityProfile.ENDTIME, 0, true);
        profile.setUse(EndEntityProfile.CLEARTEXTPASSWORD, 0, true);
        profile.setValue(EndEntityProfile.CLEARTEXTPASSWORD, 0, EndEntityProfile.TRUE);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.valueOf(approvalCAID).toString());
        profile.setUse(EndEntityProfile.STARTTIME, 0, true);
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, availableCertProfiles.toString());
        profile.setValue(EndEntityProfile.DEFAULTCERTPROFILE, 0, Integer.valueOf(certProfiles[0]).toString());
        profile.setValue(EndEntityProfile.DEFAULTCA, 0, Integer.valueOf(approvalCAID).toString());
        endEntityProfileSession.addEndEntityProfile(admin, endEntityProfileName, profile);

        int endEntityProfileId = endEntityProfileSession.getEndEntityProfileId(admin1, endEntityProfileName);
        assertTrue(endEntityProfileId != 0);
View Full Code Here

                  getLogger().error("Error : Couldn't find entity profile '"+profileid+"' in database.");
                } else if (profileid == SecConst.EMPTY_ENDENTITYPROFILE) {
                    //getLogger().debug("Skipping export fixed end entity profile with id '"+profileid+"'.");
                } else {
                  String profilename = ejb.getEndEntityProfileSession().getEndEntityProfileName(getAdmin(), profileid);
                    EndEntityProfile profile = ejb.getEndEntityProfileSession().getEndEntityProfile(getAdmin(), profileid);
                    if (profile == null) {
                      getLogger().error("Error : Couldn't find entity profile '"+profilename+"'-"+profileid+" in database.");
                    } else {
                        String outfile = outpath+"/entityprofile_"+profilename+"-"+profileid+".xml";
                        getLogger().info(outfile+".");
                        XMLEncoder encoder = new XMLEncoder(new  FileOutputStream(outfile));
                        encoder.writeObject(profile.saveData());
                        encoder.close();
                    }
                }
            }        
        } catch (Exception e) {
View Full Code Here

        PrivateKey privKey = null;
        KeyPair keyPair = null;
        KeyRecoveryData keyData = null;
        boolean reusecertificate = false;
        if(loadkeys){
          EndEntityProfile endEntityProfile = endEntityProfileSession.getEndEntityProfile(pubAdmin, userDataVO.getEndEntityProfileId());
          reusecertificate = endEntityProfile.getReUseKeyRecoveredCertificate();

          // used saved keys.
          keyData = keyRecoverySession.keyRecovery(pubAdmin, userDataVO.getUsername(), userDataVO.getEndEntityProfileId());
          keyPair = keyData.getKeyPair();
          certKey = keyPair.getPublic();
View Full Code Here

        if(!username.equals(this.username) || this.useradmindata == null){       
          this.useradmindata = ejb.getUserAdminSession().findUser(administrator, username);
       

        if (useradmindata != null) {
            EndEntityProfile eprof = ejb.getEndEntityProfileSession().getEndEntityProfile(administrator, useradmindata.getEndEntityProfileId());
            Collection<String> c = eprof.getAvailableCertificateProfileIds();
            if (!c.isEmpty()) {
              ArrayList<String> names = new ArrayList<String>();
                for (Iterator<String> i = c.iterator(); i.hasNext(); ) {
                  int id = Integer.valueOf(i.next());
                    String name = ejb.getCertificateProfileSession().getCertificateProfileName(administrator, id);
View Full Code Here

                } catch (CertificateProfileExistsException cpeee) {
                }
                certprofileid = certificateProfileSession.getCertificateProfileId(admin, TESTPROFILE);
                assertTrue(certprofileid != 0);
                // add End Entity Profile with validity limitations
                EndEntityProfile profile;
                try {
                    endEntityProfileSession.removeEndEntityProfile(admin, TESTPROFILE);
                    profile = new EndEntityProfile();
                    profile.setUse(EndEntityProfile.ENDTIME, 0, true);
                    profile.setUse(EndEntityProfile.CLEARTEXTPASSWORD, 0, false);
                    profile.setValue(EndEntityProfile.CLEARTEXTPASSWORD, 0, EndEntityProfile.FALSE);
                    profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.valueOf(caid).toString());
                    profile.setUse(EndEntityProfile.STARTTIME, 0, true);
                    profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.valueOf(certprofileid).toString());
                    profile.setValue(EndEntityProfile.DEFAULTCERTPROFILE, 0, Integer.valueOf(certprofileid).toString());
                    endEntityProfileSession.addEndEntityProfile(admin, TESTPROFILE, profile);
                } catch (EndEntityProfileExistsException pee) {
                }
                // Create a new user
                ExtendedInformation ei = new ExtendedInformation();
View Full Code Here

        }

        int profile1Id = certificateProfileSession.getCertificateProfileId(administrator, "XKMSTESTSIGN");
        int profile2Id = certificateProfileSession.getCertificateProfileId(administrator, "XKMSTESTEXCHANDENC");

        EndEntityProfile endentityprofile = new EndEntityProfile(true);
        endentityprofile.setValue(EndEntityProfile.AVAILCAS, 0, "" + caid);
        endentityprofile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, "" + SecConst.CERTPROFILE_FIXED_ENDUSER + ";" + profile1Id + ";" + profile2Id);

        try {
            endEntityProfileSession.addEndEntityProfile(administrator, "XKMSTESTPROFILE", endentityprofile);
        } catch (EndEntityProfileExistsException e) {
            log.info("Endentityprofile XKMSTESTPROFILE already exists.");
View Full Code Here

    protected void editUser() throws Exception {
        createTestCA(CA1);
        createTestCA(CA2);
        // Create suitable EE prof
        try {
            EndEntityProfile profile = new EndEntityProfile();
            profile.addField(DnComponents.ORGANIZATION);
            profile.addField(DnComponents.COUNTRY);
            profile.addField(DnComponents.COMMONNAME);
            profile.addField(DnComponents.DATEOFBIRTH);
            profile.setValue(EndEntityProfile.AVAILCAS,0,Integer.toString(SecConst.ALLCAS));
            profile.setUse(EndEntityProfile.ISSUANCEREVOCATIONREASON, 0, true);
            profile.setValue(EndEntityProfile.ISSUANCEREVOCATIONREASON,0,""+RevokedCertInfo.REVOCATION_REASON_CERTIFICATEHOLD);
            endEntityProfileSession.addEndEntityProfile(intAdmin, WS_EEPROF_EI, profile);
            endEntityProfileSession.getEndEntityProfileId(intAdmin, WS_EEPROF_EI);
        } catch (EndEntityProfileExistsException pee) {
          assertTrue("Can not create end entity profile", false);
        }
View Full Code Here

        log.error("Certificate profile exists: ", e);
      }
    }
    final int cpId = this.certificateProfileSession.getCertificateProfileId(this.admin, CPNAME);
    if (this.endEntityProfileSession.getEndEntityProfile(this.admin, EEPNAME) == null) {
      final EndEntityProfile eep = new EndEntityProfile(true);
      eep.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, "" + cpId);
      try {
        this.endEntityProfileSession.addEndEntityProfile(this.admin, EEPNAME, eep);
      } catch (EndEntityProfileExistsException e) {
        log.error("Could not create end entity profile.", e);
      }
View Full Code Here

        updatePropertyOnServer(CmpConfiguration.CONFIG_RACANAME, "ProfileDefault");
        updatePropertyOnServer(CmpConfiguration.CONFIG_RA_ENDENTITYPROFILE, EEP_1);
        // Create EEP
        if (InterfaceCache.getEndEntityProfileSession().getEndEntityProfile(ADMIN, EEP_1) == null) {
            // Configure an EndEntity profile that allows CN, O, C in DN and rfc822Name, MS UPN in altNames.
            EndEntityProfile eep = new EndEntityProfile(true);
            eep.setValue(EndEntityProfile.DEFAULTCERTPROFILE,0, "" + SecConst.CERTPROFILE_FIXED_ENDUSER);
            eep.setValue(EndEntityProfile.AVAILCERTPROFILES,0, "" + SecConst.CERTPROFILE_FIXED_ENDUSER);
            eep.setValue(EndEntityProfile.DEFAULTCA, 0, "" + getTestCAId(CA_NAME_1));
            eep.setValue(EndEntityProfile.AVAILCAS, 0, "" + getTestCAId(CA_NAME_1));
            eep.setModifyable(DnComponents.RFC822NAME, 0, true);
            eep.setUse(DnComponents.RFC822NAME, 0, false)// Don't use field from "email" data
            try {
              InterfaceCache.getEndEntityProfileSession().addEndEntityProfile(ADMIN, EEP_1, eep);
        } catch (EndEntityProfileExistsException e) {
          LOG.error("Could not create end entity profile " + EEP_1, e);
        }
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ra.raadmin.EndEntityProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.