Examples of EndUserCertificateProfile


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

        for (int i = 0; i < NUMBER_OF_USERS; i++) {
            String username = genUserName(baseUsername);
            String password = genRandomPwd();
            final String certificateProfileName = "testLotsOfCertsPerUser";
            final String endEntityProfileName = "testLotsOfCertsPerUser";
            CertificateProfile certificateProfile = new EndUserCertificateProfile();
            certificateProfile.setAllowValidityOverride(true);
            try {
                certificateProfileSession.addCertificateProfile(administrator, certificateProfileName, certificateProfile);
            } catch (CertificateProfileExistsException e) {
            }
View Full Code Here

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

    public void test01CreateNewUser() throws PersistenceException, CADoesntExistsException, AuthorizationDeniedException, UserDoesntFullfillEndEntityProfile,
            WaitingForApprovalException, EjbcaException, EndEntityProfileExistsException, FinderException {
        log.trace(">test01CreateNewUser()");

        certificateProfileSession.removeCertificateProfile(admin, "FOOCERTPROFILE");
        final EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        certprof.setAllowKeyUsageOverride(true);
        certificateProfileSession.addCertificateProfile(admin, "FOOCERTPROFILE", certprof);
        final int fooCertProfile = certificateProfileSession.getCertificateProfileId(admin, "FOOCERTPROFILE");

        endEntityProfileSession.removeEndEntityProfile(admin, "FOOEEPROFILE");
        final EndEntityProfile profile = new EndEntityProfile(true);
View Full Code Here

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

    public void test10TestQcCert() throws Exception {
        log.trace(">test10TestQcCert()");

        // Create a good certificate profile (good enough), using QC statement
        certificateProfileSession.removeCertificateProfile(admin, "TESTQC");
        EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        certprof.setUseQCStatement(true);
        certprof.setQCStatementRAName("rfc822Name=qc@primekey.se");
        certprof.setUseQCEtsiQCCompliance(true);
        certprof.setUseQCEtsiSignatureDevice(true);
        certprof.setUseQCEtsiValueLimit(true);
        certprof.setQCEtsiValueLimit(50000);
        certprof.setQCEtsiValueLimitCurrency("SEK");
        certificateProfileSession.addCertificateProfile(admin, "TESTQC", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTQC");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
View Full Code Here

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

    public void test11TestValidityOverride() throws Exception {
        log.trace(">test11TestValidityOverrideAndCardNumber()");

        // Create a good certificate profile (good enough), using QC statement
        certificateProfileSession.removeCertificateProfile(admin, "TESTVALOVERRIDE");
        EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        certprof.setAllowValidityOverride(false);
        certprof.setValidity(298);
        certprof.setUseCardNumber(true);
        certificateProfileSession.addCertificateProfile(admin, "TESTVALOVERRIDE", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTVALOVERRIDE");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
View Full Code Here

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

    public void test22DnOrder() throws Exception {
        log.trace(">test22DnOrder()");

        // Create a good certificate profile (good enough), using QC statement
        certificateProfileSession.removeCertificateProfile(admin, "TESTDNORDER");
        EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        certificateProfileSession.addCertificateProfile(admin, "TESTDNORDER", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTDNORDER");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTDNORDER");
        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.ORGANIZATION);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(cprofile));
        endEntityProfileSession.addEndEntityProfile(admin, "TESTDNORDER", profile);
        int eeprofile = endEntityProfileSession.getEndEntityProfileId(admin, "TESTDNORDER");

        UserDataVO user = new UserDataVO("foo", "C=SE,O=PrimeKey,CN=dnorder", rsacaid, null, "foo@primekey.se", SecConst.USER_ENDUSER, eeprofile, cprofile,
                SecConst.TOKEN_SOFT_PEM, 0, null);
        user.setStatus(UserDataConstants.STATUS_NEW);
        // Change a user that we know...
        userAdminSession.changeUser(admin, user, false);
        log.debug("created user: foo, foo123, C=SE,O=PrimeKey,CN=dnorder");
        X509Certificate cert = (X509Certificate) signSession.createCertificate(admin, "foo", "foo123", rsakeys.getPublic());
        assertNotNull("Failed to create certificate", cert);
        String dn = cert.getSubjectDN().getName();
        // This is the reverse order than what is displayed by openssl
        assertEquals("C=SE, O=PrimeKey, CN=dnorder", dn);

        // Change to X509 DN order
        certprof.setUseLdapDnOrder(false);
        certificateProfileSession.changeCertificateProfile(admin, "TESTDNORDER", certprof);
        userAdminSession.changeUser(admin, user, false);
        cert = (X509Certificate) signSession.createCertificate(admin, "foo", "foo123", rsakeys.getPublic());
        assertNotNull("Failed to create certificate", cert);
        dn = cert.getSubjectDN().getName();
View Full Code Here

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

    }

    public void test28TestDNOverride() throws Exception {
        // Create a good certificate profile (good enough), using QC statement
        certificateProfileSession.removeCertificateProfile(admin, "TESTDNOVERRIDE");
        EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        // Default profile does not allow DN override
        certprof.setValidity(298);
        certificateProfileSession.addCertificateProfile(admin, "TESTDNOVERRIDE", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTDNOVERRIDE");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
View Full Code Here

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

    public void test29TestExtensionOverride() throws Exception {
        final String altnames = "dNSName=foo1.bar.com,dNSName=foo2.bar.com,dNSName=foo3.bar.com,dNSName=foo4.bar.com,dNSName=foo5.bar.com,dNSName=foo6.bar.com,dNSName=foo7.bar.com,dNSName=foo8.bar.com,dNSName=foo9.bar.com,dNSName=foo10.bar.com,dNSName=foo11.bar.com,dNSName=foo12.bar.com,dNSName=foo13.bar.com,dNSName=foo14.bar.com,dNSName=foo15.bar.com,dNSName=foo16.bar.com,dNSName=foo17.bar.com,dNSName=foo18.bar.com,dNSName=foo19.bar.com,dNSName=foo20.bar.com,dNSName=foo21.bar.com";
        // Create a good certificate profile (good enough), using QC statement
        certificateProfileSession.removeCertificateProfile(admin, "TESTEXTENSIONOVERRIDE");
        EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        // Default profile does not allow Extension override
        certprof.setValidity(298);
        certificateProfileSession.addCertificateProfile(admin, "TESTEXTENSIONOVERRIDE", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTEXTENSIONOVERRIDE");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
View Full Code Here

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

    }

    public void test31TestProfileSignatureAlgorithm() throws Exception {
        // Create a good certificate profile (good enough), using QC statement
        certificateProfileSession.removeCertificateProfile(admin, "TESTSIGALG");
        EndUserCertificateProfile certprof = new EndUserCertificateProfile();
        // Default profile uses "inherit from CA"
        certificateProfileSession.addCertificateProfile(admin, "TESTSIGALG", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTSIGALG");

        // Create a good end entity profile (good enough)
View Full Code Here

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

        assertEquals("notAfter " + length + " seconds after notBefore", ext.getNotBefore().getDate().getTime() + length * 1000, ext.getNotAfter().getDate().getTime());
    }
   
    private X509Certificate privateKeyUsageGetCertificate(final boolean useStartOffset, final long startOffset, final boolean usePeriod, final long period) throws Exception {
      certificateProfileSession.removeCertificateProfile(admin, CERTPROFILE_PRIVKEYUSAGEPERIOD);
      final EndUserCertificateProfile certProfile = new EndUserCertificateProfile();
      certProfile.setUsePrivateKeyUsagePeriodNotBefore(useStartOffset);
      certProfile.setPrivateKeyUsagePeriodStartOffset(startOffset);
      certProfile.setUsePrivateKeyUsagePeriodNotAfter(usePeriod);
      certProfile.setPrivateKeyUsagePeriodLength(period);
      certificateProfileSession.addCertificateProfile(admin, CERTPROFILE_PRIVKEYUSAGEPERIOD, certProfile);
      final int certProfileId = certificateProfileSession.getCertificateProfileId(admin, CERTPROFILE_PRIVKEYUSAGEPERIOD);
      endEntityProfileSession.removeEndEntityProfile(admin, EEPROFILE_PRIVKEYUSAGEPERIOD);
        final EndEntityProfile eeProfile = new EndEntityProfile();
        eeProfile.addField(DnComponents.COUNTRY);
View Full Code Here

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

  public void setUp() throws Exception {

    certificateProfileSession.removeCertificateProfile(admin,"FOOCERTPROFILE");
    endEntityProfileSession.removeEndEntityProfile(admin, "FOOEEPROFILE");

    final EndUserCertificateProfile certprof = new EndUserCertificateProfile();
    certprof.setAllowKeyUsageOverride(true);
    certprof.setAllowCertSerialNumberOverride(true);
    certificateProfileSession.addCertificateProfile(admin, "FOOCERTPROFILE", certprof);
    fooCertProfileId = certificateProfileSession.getCertificateProfileId(admin,"FOOCERTPROFILE");

    final EndEntityProfile profile = new EndEntityProfile(true);
    profile.setValue(EndEntityProfile.DEFAULTCERTPROFILE, 0, Integer.toString(fooCertProfileId));
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.