Package org.ejbca.core.model.ca.catoken

Examples of org.ejbca.core.model.ca.catoken.HardCATokenInfo


    @Override
    public void importCAFromHSM(Admin admin, String caname, Certificate[] signatureCertChain, String catokenpassword, String catokenclasspath,
            String catokenproperties) throws Exception {
        String signatureAlgorithm = CertTools.getSignatureAlgorithm((Certificate) signatureCertChain[0]);
        HardCATokenInfo hardcatokeninfo = new HardCATokenInfo();
        hardcatokeninfo.setAuthenticationCode(catokenpassword);
        hardcatokeninfo.setCATokenStatus(ICAToken.STATUS_ACTIVE);
        hardcatokeninfo.setClassPath(catokenclasspath);
        hardcatokeninfo.setEncryptionAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA);
        hardcatokeninfo.setProperties(catokenproperties);
        hardcatokeninfo.setSignatureAlgorithm(signatureAlgorithm);

        CATokenInfo catokeninfo = hardcatokeninfo;
        CATokenContainer catoken = new CATokenContainerImpl(catokeninfo, CertTools.stringToBCDNString(
                StringTools.strip(CertTools.getSubjectDN(signatureCertChain[0]))).hashCode());
        catoken.activate(catokenpassword);
View Full Code Here


        try {              
            final String caname = args[5];
            final String dn = CertTools.stringToBCDNString(StringTools.strip(args[6]));
            final int validity = Integer.parseInt(args[7]);
            HardCATokenInfo catokeninfo = new HardCATokenInfo();
            byte keyStoreID[];{
                KeyStoreContainer ksc = KeyStoreContainerFactory.getInstance(args[4],args[2], args[3], args.length>8 ? args[8] : null, null, null);
                ksc.generate("2048", DEFAULT_KEY);
                ksc.generate("2048", SIGN_KEY);
                keyStoreID = ksc.storeKeyStore();
                catokeninfo.setAuthenticationCode(new String(ksc.getPassPhraseGetSetEntry()));
            }
            getLogger().info("Initializing CA");           
            getLogger().info("Generating rootCA keystore:");
            getLogger().info("CA name: "+caname);
            getLogger().info("DN: "+dn);
            getLogger().info("Validity (days): "+validity);
                           
            catokeninfo.setSignatureAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA);
            catokeninfo.setEncryptionAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA);
            {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                pw.println(KeyStrings.CAKEYPURPOSE_DEFAULT_STRING+" "+DEFAULT_KEY);
                pw.println(KeyStrings.CAKEYPURPOSE_CERTSIGN_STRING+" "+SIGN_KEY);
                pw.println(NFastCAToken.SLOT_LABEL_KEY+" "+new String(keyStoreID));
                pw.close();
                catokeninfo.setProperties(sw.toString());
            }
            catokeninfo.setClassPath(org.ejbca.core.model.ca.catoken.NFastCAToken.class.getName());
            X509CAInfo cainfo = new X509CAInfo(dn,
                                             caname, SecConst.CA_ACTIVE, new Date(),
                                             "", SecConst.CERTPROFILE_FIXED_ROOTCA,
                                             validity,
                                             null, // Expiretime                                            
View Full Code Here

              softcatokeninfo.setEncKeySpec("2048");
              softcatokeninfo.setEncKeyAlgorithm(AlgorithmConstants.KEYALGORITHM_RSA);
              softcatokeninfo.setEncryptionAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA);
              catokeninfo = softcatokeninfo;
            } else {
              HardCATokenInfo hardcatokeninfo = new HardCATokenInfo();
              hardcatokeninfo.setAuthenticationCode(catokenpassword);
              hardcatokeninfo.setCATokenStatus(ICAToken.STATUS_ACTIVE);
              hardcatokeninfo.setClassPath(catokentype);
              hardcatokeninfo.setEncryptionAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA);
              hardcatokeninfo.setProperties(catokenproperties);
              hardcatokeninfo.setSignatureAlgorithm(signAlg);
              catokeninfo = hardcatokeninfo;
            }
           
            // Create and active OSCP CA Service.
            ArrayList extendedcaservices = new ArrayList();
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ca.catoken.HardCATokenInfo

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.