Package org.ejbca.core.model.hardtoken.profiles

Examples of org.ejbca.core.model.hardtoken.profiles.HardTokenProfile


        if (log.isTraceEnabled()) {
            log.trace(">cloneHardTokenProfile(name: " + oldname + ")");
        }
        HardTokenProfileData htp = HardTokenProfileData.findByName(entityManager, oldname);
        try {
            HardTokenProfile profiledata = (HardTokenProfile) getHardTokenProfile(htp).clone();
            try {
                addHardTokenProfile(admin, newname, profiledata);
                String msg = intres.getLocalizedMessage("hardtoken.clonedprofile", newname, oldname);
                logSession.log(admin, admin.getCaId(), LogConstants.MODULE_HARDTOKEN, new java.util.Date(), null, null,
                        LogConstants.EVENT_INFO_HARDTOKENPROFILEDATA, msg);
View Full Code Here


        HashSet<Integer> authorizedcaids = new HashSet<Integer>(caSession.getAvailableCAs(admin));
        Collection<HardTokenProfileData> result = HardTokenProfileData.findAll(entityManager);
        Iterator<HardTokenProfileData> i = result.iterator();
        while (i.hasNext()) {
            HardTokenProfileData next = i.next();
            HardTokenProfile profile = getHardTokenProfile(next);
            if (profile instanceof EIDProfile) {
                if (authorizedcertprofiles.containsAll(((EIDProfile) profile).getAllCertificateProfileIds())
                        && authorizedcaids.containsAll(((EIDProfile) profile).getAllCAIds())) {
                    returnval.add(next.getId());
                }
View Full Code Here

        return returnval;
    }

    @Override
    public HardTokenProfile getHardTokenProfile(Admin admin, String name) {
        HardTokenProfile returnval = null;
        HardTokenProfileData htpd = HardTokenProfileData.findByName(entityManager, name);
        if (htpd != null) {
            returnval = getHardTokenProfile(htpd);
        }
        return returnval;
View Full Code Here

        return returnval;
    }

    @Override
    public HardTokenProfile getHardTokenProfile(Admin admin, int id) {
        HardTokenProfile returnval = null;
        HardTokenProfileData htpd = HardTokenProfileData.findByPK(entityManager, Integer.valueOf(id));
        if (htpd != null) {
            returnval = getHardTokenProfile(htpd);
        }
        return returnval;
View Full Code Here

        }
    }

    @Override
    public boolean existsCertificateProfileInHardTokenProfiles(Admin admin, int id) {
        HardTokenProfile profile = null;
        Collection<Integer> certprofiles = null;
        boolean exists = false;
        Collection<HardTokenProfileData> result = HardTokenProfileData.findAll(entityManager);
        Iterator<HardTokenProfileData> i = result.iterator();
        while (i.hasNext() && !exists) {
View Full Code Here

        }
        return retval;
    }

    private HardTokenProfile getHardTokenProfile(HardTokenProfileData htpData) {
        HardTokenProfile profile = null;
        java.beans.XMLDecoder decoder;
        try {
            decoder = new java.beans.XMLDecoder(new java.io.ByteArrayInputStream(htpData.getData().getBytes("UTF8")));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        HashMap h = (HashMap) decoder.readObject();
        decoder.close();
        // Handle Base64 encoded string values
        HashMap data = new Base64GetHashMap(h);
        switch (((Integer) (data.get(HardTokenProfile.TYPE))).intValue()) {
        case SwedishEIDProfile.TYPE_SWEDISHEID:
            profile = new SwedishEIDProfile();
            break;
        case EnhancedEIDProfile.TYPE_ENHANCEDEID:
            profile = new EnhancedEIDProfile();
            break;
        case TurkishEIDProfile.TYPE_TURKISHEID:
            profile = new TurkishEIDProfile();
            break;
        }
        profile.loadData(data);
        return profile;
    }
View Full Code Here

     *             error
     */
    public void test04EditHardTokenProfile() throws Exception {
        log.trace(">test04EditHardTokenProfile()");
        boolean ret = false;
        HardTokenProfile profile = hardTokenSession.getHardTokenProfile(admin, "ENHTEST");
        profile.setHardTokenSNPrefix("11111");
        hardTokenSession.changeHardTokenProfile(admin, "ENHTEST", profile);
        ret = true;
        assertTrue("Editing HardTokenProfile failed", ret);
        log.trace("<test04EditHardTokenProfile()");
    }
View Full Code Here

            final String signReq = request.getParameter("signpkcs10");
           
            if ( authReq!=null && signReq!=null ) {
                final int authCertProfile;
                final int signCertProfile;
                final HardTokenProfile hardTokenProfile = hardTokenSession.getHardTokenProfile(administrator, data.getTokenType());
                {
                    CertProfileID certProfileID = new CertProfileID(data, administrator, hardTokenProfile);
                    authCertProfile = certProfileID.getProfileID("authCertProfile", SwedishEIDProfile.CERTUSAGE_AUTHENC);
                    signCertProfile = certProfileID.getProfileID("signCertProfile", SwedishEIDProfile.CERTUSAGE_SIGN);
                }
View Full Code Here

                    authCA = submessage.getAuthCA();
                  }
                  if (submessage.getSignCA() != -1) {
                    signCA = submessage.getSignCA();
                  }
                        HardTokenProfile htp = hardTokenSession.getHardTokenProfile(admin, data.getTokenType());
                        if ( htp!=null && htp instanceof EIDProfile ) {
                          EIDProfile hardTokenProfile = (EIDProfile)htp;
                          if (authCertProfile == -1) {
                            authCertProfile = hardTokenProfile.getCertificateProfileId(SwedishEIDProfile.CERTUSAGE_AUTHENC);                           
                          }
View Full Code Here

   
    /**
     * Help function that checks if administrator is authorized to edit profile with given name.
     */
    private boolean authorizedToProfileName(String profilename, boolean editcheck){
    HardTokenProfile profile = hardtokensession.getHardTokenProfile(administrator, profilename);
    return authorizedToProfile(profile, editcheck);
    }
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.hardtoken.profiles.HardTokenProfile

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.