Package org.ejbca.extra.util

Examples of org.ejbca.extra.util.RAKeyStore


            cryptProvider = getInitParameter("cryptProvider");

            keyStoreNumber = "."+getInitParameter("keyStoreNumber");
            String kspath = ExtraConfiguration.instance().getString(ExtraConfiguration.SCEPKEYSTOREPATH+keyStoreNumber);
            String kspwd = ExtraConfiguration.instance().getString(ExtraConfiguration.SCEPKEYSTOREPWD+keyStoreNumber);
            scepraks = new RAKeyStore(kspath, kspwd);
           
            String randomAlgorithm = "SHA1PRNG";
            randomSource = SecureRandom.getInstance(randomAlgorithm);
           
            msgHome = new MessageHome(Persistence.createEntityManagerFactory("ScepRAMessageDS"), MessageHome.MESSAGETYPE_SCEPRA, true)//false);
View Full Code Here


                log.error("extRAKeystorePath cannot be empty");
            } else if (StringUtils.isEmpty(extRaKeystorePwd)) {
                log.error("extRAKeystorePath cannot be empty");
            } else {
                try {
                    RAKeyStore extRaKeyStore = new RAKeyStore(extRaKeystorePath, extRaKeystorePwd);
                    extRaCertificate = (X509Certificate)extRaKeyStore.getKeyStore().getCertificate(extRaKeyStore.getAlias());
                    extRaKey = (PrivateKey) extRaKeyStore.getKeyStore().getKey(extRaKeyStore.getAlias(), extRaKeystorePwd.toCharArray());
                    log.info("Loaded keystore from: "+extRaKeystorePath);
                } catch (Exception e) {
                    log.error("Error reading External RA keystore '"+extRaKeystorePath+ " " +extRaKeystorePwd+ "', no keystore loaded: ", e);
                }                            
            }
View Full Code Here

         !securitylevel.equalsIgnoreCase(SECURITY_ENCRYPTED) &&
         !securitylevel.equalsIgnoreCase(SECURITY_SIGNEDENCRYPTED)){
        throw new Exception("Invalid SecurityLevel: "+securitylevel);
      }
      if(securitylevel.equalsIgnoreCase(SECURITY_SIGNED) || securitylevel.equalsIgnoreCase(SECURITY_SIGNEDENCRYPTED)){
        RAKeyStore rakeystore = new RAKeyStore(args[ARG_KEYSTOREPATH], args[ARG_PASSWORD]);      
        Certificate[] chain = rakeystore.getKeyStore().getCertificateChain(rakeystore.getAlias());
        cAChain = new Vector();
        for(int i=0; i< chain.length ; i++){
          if(((X509Certificate) chain[i]).getBasicConstraints() != -1){
            cAChain.add(chain[i]);
          }
        }
        raKey = (PrivateKey) rakeystore.getKeyStore().getKey(rakeystore.getAlias(), args[ARG_PASSWORD].toCharArray());
        raCert = (X509Certificate) rakeystore.getKeyStore().getCertificate(rakeystore.getAlias());
      }
      if(securitylevel.equalsIgnoreCase(SECURITY_ENCRYPTED) || securitylevel.equalsIgnoreCase(SECURITY_SIGNEDENCRYPTED)){
            CertificateFactory cf = CertTools.getCertificateFactory();
            encCert = (X509Certificate) cf.generateCertificate(new FileInputStream(args[ARG_ENCRYPTIONCERT]));
      }
View Full Code Here

      }
    }
        msgHome = new MessageHome(entityManagerFactories.get(persistenceUnit), MessageHome.MESSAGETYPE_EXTRA, true)// We manage transactions ourself for this DataSource

    try {
      serviceKeyStore = new RAKeyStore(keystorePath, keystorePwd);
    } catch (Exception e) {
      if(encryptionRequired || signatureRequired){
        log.error("Error reading ExtRACAService keystore" ,e);
      }else{
        log.debug("ExtRACAService KeyStore couldn't be configured, but isn't required")
View Full Code Here

TOP

Related Classes of org.ejbca.extra.util.RAKeyStore

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.