Examples of CertificateProfile


Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

        globalConfigurationSession.saveGlobalConfigurationRemote(intAdmin, gc);
        if (certificateProfileSession.getCertificateProfileId(intAdmin, "WSTESTPROFILE") != 0) {
            certificateProfileSession.removeCertificateProfile(intAdmin, "WSTESTPROFILE");
        }

        CertificateProfile profile = new EndUserCertificateProfile();
        profile.setAllowValidityOverride(true);
        certificateProfileSession.addCertificateProfile(intAdmin, "WSTESTPROFILE", profile);

        // first a simple test
        UserDataVOWS tokenUser1 = new UserDataVOWS();
        tokenUser1.setUsername("WSTESTTOKENUSER1");
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

        if (useradmindata != null) {
            int certprofile = useradmindata.getCertificateProfileId();

            if (certprofile != SecConst.PROFILE_NO_PROFILE) {
                CertificateProfile p = ejb.getCertificateProfileSession().getCertificateProfile(administrator, certprofile);
                returnval = p.getAvailableBitLengths();
            }
        }
        this.username = username;

        if (log.isDebugEnabled()) {
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

    updatePropertyOnServer(CmpConfiguration.CONFIG_RA_ENDENTITYPROFILE, "KeyId");
    updatePropertyOnServer(CmpConfiguration.CONFIG_RACANAME, cainfo.getName());
    updatePropertyOnServer(CmpConfiguration.CONFIG_CERTREQHANDLER_CLASS, UnidFnrHandler.class.getName());
    // Configure a Certificate profile (CmpRA) using ENDUSER as template
    if (this.certificateProfileSession.getCertificateProfile(this.admin, CPNAME) == null) {
      final CertificateProfile cp = new EndUserCertificateProfile();
      try { // TODO: Fix this better
        this.certificateProfileSession.addCertificateProfile(this.admin, CPNAME, cp);
      } catch (CertificateProfileExistsException e) {
        log.error("Certificate profile exists: ", e);
      }
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

        updatePropertyOnServer(CmpConfiguration.CONFIG_RA_AUTHENTICATIONSECRET, "password");
        updatePropertyOnServer(CmpConfiguration.CONFIG_RA_CERTIFICATEPROFILE, CPNAME);
        updatePropertyOnServer(CmpConfiguration.CONFIG_RA_ENDENTITYPROFILE, EEPNAME);
        // Configure a Certificate profile (CmpRA) using ENDUSER as template and check "Allow validity override".
        if (certificateProfileSession.getCertificateProfile(admin, CPNAME) == null) {
            CertificateProfile cp = new EndUserCertificateProfile();
            cp.setAllowValidityOverride(true);
            try // TODO: Fix this better
        certificateProfileSession.addCertificateProfile(admin, CPNAME, cp);
      } catch (CertificateProfileExistsException e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

    public CrmfRARequestCustomSerialNoTest(String arg0) throws CertificateEncodingException, CertificateException {
        super(arg0);

        admin = new Admin(Admin.TYPE_BATCHCOMMANDLINE_USER);
        // Configure CMP for this test, we allow custom certificate serial numbers
      CertificateProfile profile = new EndUserCertificateProfile();
      //profile.setAllowCertSerialNumberOverride(true);
      try {
        certProfileSession.addCertificateProfile(admin, "CMPTESTPROFILE", profile);
    } catch (CertificateProfileExistsException e) {
      log.error("Could not create certificate profile.", e);
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

            // crmfHttpUserTest checks the returned serno if bint parameter is not null
            updatePropertyOnServer(CmpConfiguration.CONFIG_RA_ALLOWCUSTOMCERTSERNO, "true");
        crmfHttpUserTest(userDN1, key1, "Used certificate profile ('"+cpId+"') is not allowing certificate serial number override.", bint);
        // Third it should succeed and we should get our custom requested serialnumber
            updatePropertyOnServer(CmpConfiguration.CONFIG_RA_ALLOWCUSTOMCERTSERNO, "true");
        CertificateProfile cp = certProfileSession.getCertificateProfile(admin, "CMPTESTPROFILE");
        cp.setAllowCertSerialNumberOverride(true);
        // Now when the profile allows serial number override it should work
        certProfileSession.changeCertificateProfile(admin, "CMPTESTPROFILE", cp);
        crmfHttpUserTest(userDN1, key1, null, bint);
      } finally {
        try {
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

    if (certificateProfileSession.getCertificateProfileId(intAdmin, "WSTESTPROFILE") != 0) {
      certificateProfileSession.removeCertificateProfile(intAdmin, "WSTESTPROFILE");
    }

    CertificateProfile profile = new EndUserCertificateProfile();
    profile.setAllowCertSerialNumberOverride(true);
    certificateProfileSession.addCertificateProfile(intAdmin, "WSTESTPROFILE", profile);

    //Creating certificate for user: wsfoo
    UserDataVOWS user = new UserDataVOWS("wsfoo", "foo123", true, "C=SE, CN=wsfoo",
        getAdminCAName(), null, "foo@anatom.se", UserDataVOWS.STATUS_NEW,
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

  public static int getOrCreateCertificateProfile(Admin admin, int templateIndex, CertificateProfileSession certificateProfileSession) {
    String certProfileName = "Autoenroll-" + SUPPORTEDCERTIFICATETEMPLATES[templateIndex];
    // Create certificate profile if neccesary
    boolean newCertificateProfile = false;
    CertificateProfile certProfile = certificateProfileSession.getCertificateProfile(admin, certProfileName);
    if (certProfile == null) {
      certProfile = new CertificateProfile();
      try {
          certificateProfileSession.addCertificateProfile(admin, certProfileName, certProfile);
        newCertificateProfile = true;
      } catch (CertificateProfileExistsException e) {
        throw new EJBException(e)// We just checked for this so this cannot happen
      }
    }
    // Add User-specifics to profiles if nessesary
    int[] keyUsages = KEYUSAGES[templateIndex];
    String[] extendedKeyUsages = EXTENDEDKEYUSAGES[templateIndex];
    if (newCertificateProfile) {
      certProfile.setUseKeyUsage(true);
      certProfile.setKeyUsageCritical(true);
      certProfile.setKeyUsage(new boolean[9]);
      for (int i=0; i<keyUsages.length; i++) {
        certProfile.setKeyUsage(keyUsages[i], true);
      }
      certProfile.setUseExtendedKeyUsage(true);
      certProfile.setExtendedKeyUsageCritical(true);
      ArrayList<String> eku = new ArrayList<String>();
      for (int i=0; i<extendedKeyUsages.length; i++) {
        eku.add(extendedKeyUsages[i]);
      }
      certProfile.setExtendedKeyUsage(eku);
      if (USE_CA_CDP[templateIndex]) {
        certProfile.setUseCRLDistributionPoint(true);
        certProfile.setUseDefaultCRLDistributionPoint(true);
      }
      if (MS_TEMPLATE_VALUE[templateIndex] != null) {
        certProfile.setUseMicrosoftTemplate(true);
        certProfile.setMicrosoftTemplate(MS_TEMPLATE_VALUE[templateIndex]);
      }
    }
    certificateProfileSession.changeCertificateProfile(admin, certProfileName, certProfile);
    return certificateProfileSession.getCertificateProfileId(admin, certProfileName);
  }
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

        }
    }

    public void testExecuteWithCustomCertificateProfile() throws CertificateProfileExistsException, ErrorAdminCommandException {
        if (certificateProfileSessionRemote.getCertificateProfile(admin, CERTIFICATE_PROFILE_NAME) == null) {
            CertificateProfile certificateProfile = new CertificateProfile();
            certificateProfileSessionRemote.addCertificateProfile(admin, CERTIFICATE_PROFILE_NAME, certificateProfile);
        }
        try {
            CertificateProfile apa = certificateProfileSessionRemote.getCertificateProfile(admin, CERTIFICATE_PROFILE_NAME);
            assertNotNull(apa);
            caInitCommand.execute(CUSTOM_PROFILE_ARGS);
            assertNull("CA was created using created using non ROOTCA or SUBCA certificate profile.", caAdminSession.getCAInfo(admin, CA_NAME));
        } finally {
            certificateProfileSessionRemote.removeCertificateProfile(admin, CERTIFICATE_PROFILE_NAME);
View Full Code Here

Examples of org.ejbca.core.model.ca.certificateprofiles.CertificateProfile

          caadminsession.publishCACertificate(administrator, cmscert, publishers, cainfo.getSubjectDN());
        }
      }
    }
  } 
    CertificateProfile certprofile = certificateProfileSession.getCertificateProfile(administrator, cainfo.getCertificateProfileId());
    // A CA certificate is published where the CRL is published and if there is a publisher noted in the certificate profile
    // (which there is probably not)
    publishers.addAll(certprofile.getPublisherList());
    caadminsession.publishCACertificate(administrator, cainfo.getCertificateChain(), publishers, cainfo.getSubjectDN());
    crlCreateSession.publishCRL(administrator, (Certificate) cainfo.getCertificateChain().iterator().next(), publishers, cainfo.getSubjectDN(), cainfo.getDeltaCRLPeriod()>0);
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.