Package org.ejbca.ui.cli.batch

Examples of org.ejbca.ui.cli.batch.BatchMakeP12


            userAdminSession.addUser(intAdmin, user1, true);
            userAdded = true;
        }

        if (userAdded) {
            BatchMakeP12 batch = new BatchMakeP12();
            batch.setMainStoreDir("p12");
            batch.createAllNew();
        }

    }
View Full Code Here


        userAdminSession.addUser(internalAdmin, userdata, true);
        UserDataVO userdata2 = new UserDataVO(requestingAdminUsername, "CN=" + requestingAdminUsername, caid, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata2.setPassword("foo123");
        userAdminSession.addUser(internalAdmin, userdata2, true);
        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
        adminentities = new ArrayList<AdminEntity>();
        adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminUsername, caid));
        adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, requestingAdminUsername, caid));
        adminEntitySession.addAdminEntities(internalAdmin, AdminGroup.TEMPSUPERADMINGROUP, adminentities);
        authorizationSession.forceRuleUpdate(internalAdmin);
View Full Code Here

    private void createUser(Admin admin, String username, int caID) throws Exception {
        UserDataVO userdata = new UserDataVO(username, "CN=" + username, caID, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata.setPassword("foo123");
        userAdminSession.addUser(admin, userdata, true);
        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
    }
View Full Code Here

            userAdminSession.setClearTextPassword(administrator, username, "foo123");
        } catch (Exception e) {
            assertTrue("Failed to create user " + username, false);
        }

        BatchMakeP12 makep12 = new BatchMakeP12();
        tmpfile = new File("p12");

        // log.debug("tempdir="+tmpfile.getParent());
        makep12.setMainStoreDir(tmpfile.getAbsolutePath());
        makep12.createAllNew();
      log.trace("<test00SetupAccessRights");
    }
View Full Code Here

    }

    private void createUser(Admin admin, UserDataVO userdata) throws PersistenceException, AuthorizationDeniedException,
            UserDoesntFullfillEndEntityProfile, ApprovalException, WaitingForApprovalException, Exception {
        userAdminSession.addUser(admin, userdata, true);
        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
        UserDataVO userdata2 = userAdminSession.findUser(admin, userdata.getUsername());
        assertNotNull("findUser: " + userdata.getUsername(), userdata2);
        createdUsers.add(userdata.getUsername());
        log.info("created: " + userdata.getUsername());
    }
View Full Code Here

    private X509Certificate createUserAndCert(String username, int caID) throws Exception {
        UserDataVO userdata = new UserDataVO(username, "CN=" + username, caID, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata.setPassword("foo123");
        userAdminSession.addUser(intAdmin, userdata, true);
        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
        Collection<Certificate> userCerts = certificateStoreSession.findCertificatesByUsername(intAdmin, username);
        assertTrue(userCerts.size() == 1);
        return (X509Certificate) userCerts.iterator().next();
    }
View Full Code Here

            // Create a user and generate the cert
            UserDataVO userdata = new UserDataVO(username, "CN=" + username, cainfo.getCAId(), null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                    SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
            userdata.setPassword("foo123");
            userAdminSession.addUser(admin, userdata, true);
            BatchMakeP12 makep12 = new BatchMakeP12();
            File tmpfile = File.createTempFile("ejbca", "p12");
            makep12.setMainStoreDir(tmpfile.getParent());
            makep12.createAllNew();
            Collection<java.security.cert.Certificate> userCerts = certificateStoreSession.findCertificatesByUsername(admin, username);
            assertTrue(userCerts.size() == 1);
            X509Certificate cert = (X509Certificate) userCerts.iterator().next();
            // revoke via CMP and verify response
            byte[] nonce = CmpMessageHelper.createSenderNonce();
View Full Code Here

        UserDataVO userdata = new UserDataVO(adminusername1, "CN=" + adminusername1, caid, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata.setPassword("foo123");
        userAdminSession.addUser(intadmin, userdata, true);

        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");

        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();

        adminEntities = new ArrayList<AdminEntity>();
        adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername1, caid));
        adminEntitySession.addAdminEntities(intadmin, AdminGroup.TEMPSUPERADMINGROUP, adminEntities);
View Full Code Here

        userdata.setPassword("foo123");

        userAdminSession.addUser(intadmin, userdata, true);

        File tmpfile = File.createTempFile("ejbca", "p12");
        BatchMakeP12 makep12 = new BatchMakeP12();
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
        tmpfile.delete();

        List<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
        adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername, caid));
        adminEntitySession.addAdminEntities(intadmin, AdminGroup.TEMPSUPERADMINGROUP, adminEntities);
View Full Code Here

             KeyPair rsakey = KeyTools.genKeys("1024", AlgorithmConstants.KEYALGORITHM_RSA);
          externalcert = CertTools.genSelfCert("CN=externalCert,C=SE", 30, null, rsakey.getPrivate(), rsakey.getPublic(), AlgorithmConstants.SIGALG_SHA1_WITH_RSA, false);
          externaladmin = new Admin(externalcert, null, null);
           
            File tmpfile = File.createTempFile("ejbca", "p12");
            BatchMakeP12 makep12 = new BatchMakeP12();
            makep12.setMainStoreDir(tmpfile.getParent());
            makep12.createAllNew();
            tmpfile.delete();
           
            adminentities = new ArrayList<AdminEntity>();
            adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername1, caid));
            adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername2, caid));
View Full Code Here

TOP

Related Classes of org.ejbca.ui.cli.batch.BatchMakeP12

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.