Package org.ejbca.core.model.util

Examples of org.ejbca.core.model.util.GenerateToken


        EndEntityProfile endEntityProfile = endEntityProfileSession.getEndEntityProfile(admin, endEntityProfileId);
        boolean reusecertificate = endEntityProfile.getReUseKeyRecoveredCertificate();
        log.debug("reusecertificate: "+reusecertificate);

        try {
          GenerateToken tgen = new GenerateToken(authenticationSession, userAdminSession, caAdminSession, keyRecoverySession, signSession);
          java.security.KeyStore pkcs12 = tgen.generateOrKeyRecoverToken(admin, username, password, caid, keyspec, keyalg, false, loadkeys, savekeys, reusecertificate, endEntityProfileId);
                  final KeyStore retval = new KeyStore(pkcs12, password);
          final Enumeration<String> en = pkcs12.aliases();
          final String alias = en.nextElement();
                  final X509Certificate cert = (X509Certificate) pkcs12.getCertificate(alias);
                  if ( (hardTokenSN != null) && (cert != null) ) {
View Full Code Here


      }
      // Generate keystore
      String password = userdata.getPassword();
      String username = userdata.getUsername();
      int caid = userdata.getCAId();
        GenerateToken tgen = new GenerateToken(authenticationSession, userAdminSession, caAdminSession, keyRecoverySession, signSession);
        KeyStore keyStore = tgen.generateOrKeyRecoverToken(admin, username, password, caid, keyspec, keyalg, createJKS, loadkeys, savekeys, reusecertificate, endEntityProfileId);
      String alias = keyStore.aliases().nextElement();
        X509Certificate cert = (X509Certificate) keyStore.getCertificate(alias);
        if ( (hardTokenSN != null) && (cert != null) ) {
          hardTokenSession.addHardTokenCertificateMapping(admin,hardTokenSN,cert);                
        }
View Full Code Here

      boolean usekeyrecovery = globalConfigurationSession.getCachedGlobalConfiguration(admin).getEnableKeyRecovery();
      boolean savekeys = data.getKeyRecoverable() && usekeyrecovery &&  (data.getStatus() != UserDataConstants.STATUS_KEYRECOVERY);
      boolean loadkeys = (data.getStatus() == UserDataConstants.STATUS_KEYRECOVERY) && usekeyrecovery;
      boolean reusecertificate = endEntityProfileSession.getEndEntityProfile(admin, endEntityProfileId).getReUseKeyRecoveredCertificate();
      // Generate or recover keystore and save it in the configured format
      GenerateToken tgen = new GenerateToken(authenticationSession, userAdminSession, caAdminSession, keyRecoverySession, signSession);
      byte[] buf = null;
      int tokentype = data.getTokenType();
      boolean createJKS = (tokentype == SecConst.TOKEN_SOFT_JKS);
      KeyStore ks = tgen.generateOrKeyRecoverToken(admin, submessage.getUsername(), submessage.getPassword(), data.getCAId(), "2048", AlgorithmConstants.KEYALGORITHM_RSA,
          createJKS, loadkeys, savekeys, reusecertificate, endEntityProfileId);
      if (tokentype == SecConst.TOKEN_SOFT_PEM) {
        buf = KeyTools.getSinglePemFromKeyStore(ks, submessage.getPassword().toCharArray());
      } else if (tokentype == SecConst.TOKEN_SOFT_P12 || tokentype == SecConst.TOKEN_SOFT_JKS) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

        }
      }

      // get users Token Type.
      tokentype = data.getTokenType();
      GenerateToken tgen = new GenerateToken(authenticationSession, userAdminSession, caAdminSession, keyRecoverySession, signSession);
      if(tokentype == SecConst.TOKEN_SOFT_P12){
        KeyStore ks = tgen.generateOrKeyRecoverToken(administrator, username, password, data.getCAId(), keylength, keyalg, false, loadkeys, savekeys, reusecertificate, endEntityProfileId);
        if (StringUtils.equals(openvpn, "on")) {               
          sendOpenVPNToken(ks, username, password, response);
        } else {
          sendP12Token(ks, username, password, response);
        }
      }
      if(tokentype == SecConst.TOKEN_SOFT_JKS){
        KeyStore ks = tgen.generateOrKeyRecoverToken(administrator, username, password, data.getCAId(), keylength, keyalg, true, loadkeys, savekeys, reusecertificate, endEntityProfileId);
        sendJKSToken(ks, username, password, response);
      }
      if(tokentype == SecConst.TOKEN_SOFT_PEM){
        KeyStore ks = tgen.generateOrKeyRecoverToken(administrator, username, password, data.getCAId(), keylength, keyalg, false, loadkeys, savekeys, reusecertificate, endEntityProfileId);
        sendPEMTokens(ks, username, password, response);
      }
      if(tokentype == SecConst.TOKEN_SOFT_BROWSERGEN){

        // first check if it is a Firefox request,
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.util.GenerateToken

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.