Examples of CertificateResponse


Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

        user1.setTokenType(UserDataVOWS.TOKEN_TYPE_USERGENERATED);
        user1.setEndEntityProfileName("EMPTY");
        user1.setCertificateProfileName("ENDUSER");
        ejbcaraws.editUser(user1);

        CertificateResponse certenv = ejbcaraws.crmfRequest(CA1_WSTESTUSER1, "foo123", CRMF, null, CertificateHelper.RESPONSETYPE_CERTIFICATE);

        assertNotNull(certenv);

        X509Certificate cert = (X509Certificate) CertificateHelper.getCertificate(certenv.getData());

        assertNotNull(cert);
        log.info(cert.getSubjectDN().toString());
        assertEquals(getDN(CA1_WSTESTUSER1), cert.getSubjectDN().toString());
    }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

        user1.setTokenType(UserDataVOWS.TOKEN_TYPE_USERGENERATED);
        user1.setEndEntityProfileName("EMPTY");
        user1.setCertificateProfileName("ENDUSER");
        ejbcaraws.editUser(user1);

        CertificateResponse certenv = ejbcaraws.spkacRequest(CA1_WSTESTUSER1, "foo123", SPCAK, null, CertificateHelper.RESPONSETYPE_CERTIFICATE);

        assertNotNull(certenv);

        X509Certificate cert = (X509Certificate) CertificateHelper.getCertificate(certenv.getData());

        assertNotNull(cert);

        assertEquals(getDN(CA1_WSTESTUSER1), cert.getSubjectDN().toString());
    }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

        KeyPair keys = KeyTools.genKeys("1024", AlgorithmConstants.KEYALGORITHM_RSA);
        PKCS10CertificationRequest pkcs10 = new PKCS10CertificationRequest("SHA1WithRSA", CertTools.stringToBcX509Name("CN=NOUSED"), keys.getPublic(),
                new DERSet(), keys.getPrivate());

        CertificateResponse certenv = ejbcaraws.pkcs10Request(CA1_WSTESTUSER1, "foo123", new String(Base64.encode(pkcs10.getEncoded())), null,
                CertificateHelper.RESPONSETYPE_CERTIFICATE);

        assertNotNull(certenv);
        assertTrue(certenv.getResponseType().equals(CertificateHelper.RESPONSETYPE_CERTIFICATE));
        X509Certificate cert = (X509Certificate) CertificateHelper.getCertificate(certenv.getData());

        assertNotNull(cert);
        assertTrue(cert.getSubjectDN().toString().equals(getDN(CA1_WSTESTUSER1)));

        ejbcaraws.editUser(userdatas.get(0));
        certenv = ejbcaraws
                .pkcs10Request(CA1_WSTESTUSER1, "foo123", new String(Base64.encode(pkcs10.getEncoded())), null, CertificateHelper.RESPONSETYPE_PKCS7);
        assertTrue(certenv.getResponseType().equals(CertificateHelper.RESPONSETYPE_PKCS7));
        CMSSignedData cmsSignedData = new CMSSignedData(CertificateHelper.getPKCS7(certenv.getData()));
        assertTrue(cmsSignedData != null);

        CertStore certStore = cmsSignedData.getCertificatesAndCRLs("Collection", "BC");
        assertTrue(certStore.getCertificates(null).size() == 1);
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

            super(_jobData);
            this.pkcs10 = new PKCS10CertificationRequest("SHA1WithRSA", CertTools.stringToBcX509Name("CN=NOUSED"), keys.getPublic(), new DERSet(), keys.getPrivate());
            this.ejbcaWS = _ejbcaWS;
        }
        public boolean doIt() throws Exception {
            final CertificateResponse certificateResponse = this.ejbcaWS.pkcs10Request(this.jobData.userName, this.jobData.passWord,
                                                                                       new String(Base64.encode(this.pkcs10.getEncoded())),null,CertificateHelper.RESPONSETYPE_CERTIFICATE);
            return checkAndLogCertificateResponse(certificateResponse, this.jobData);
        }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

            this.user.setPassword(this.jobData.passWord);
            int requestType = CertificateHelper.CERT_REQ_TYPE_PKCS10;
            String responseType = CertificateHelper.RESPONSETYPE_CERTIFICATE;
            String hardTokenSN = null; // not used
            String requestData = new String(Base64.encode(this.pkcs10.getEncoded()));
            final CertificateResponse certificateResponse = this.ejbcaWS.certificateRequest(this.user, requestData, requestType, hardTokenSN, responseType);
            return checkAndLogCertificateResponse(certificateResponse, this.jobData);
        }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

           

            try{

              //UserDataVOWS userdata, String requestData, int requestType, String hardTokenSN, String responseType)
              CertificateResponse result = getEjbcaRAWS().certificateRequest(userdata,requestdata,requesttype, hardtokensn,CertificateHelper.RESPONSETYPE_CERTIFICATE);
             
              if(result==null){
                getPrintStream().println("No certificate could be generated for user, check server logs for error.");
              }else{
                String filepath = userdata.getUsername();
                if(encoding.equals("DER")){
                  filepath += ".cer";
                }else{
                  filepath += ".pem";
                }
                if(outputPath != null){
                  filepath = outputPath + "/" + filepath;
                }
               
               
                if(encoding.equals("DER")){
                  FileOutputStream fos = new FileOutputStream(filepath);
                  fos.write(CertificateHelper.getCertificate(result.getData()).getEncoded());
                  fos.close();
                }else{
                  FileOutputStream fos = new FileOutputStream(filepath);
                  ArrayList<java.security.cert.Certificate> list = new ArrayList<java.security.cert.Certificate>();
                  list.add(CertificateHelper.getCertificate(result.getData()));
                  fos.write(CertTools.getPEMFromCerts(list));
                  fos.close();                                       
                }
                getPrintStream().println("Certificate generated, written to " + filepath);
              }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

            try{
              getEjbcaRAWS().editUser(userdata);             
              getPrintStream().println("User '"+userdata.getUsername()+"' has been added/edited.");
              getPrintStream().println();      
             
               CertificateResponse result = getEjbcaRAWS().pkcs10Request(username,password,pkcs10,hardtokensn,CertificateHelper.RESPONSETYPE_CERTIFICATE);
             
              if(result==null){
                getPrintStream().println("No certificate could be generated for user, check server logs for error.");
              }else{
                String filepath = username;
                if(encoding.equals("DER")){
                  filepath += ".cer";
                }else{
                  filepath += ".pem";
                }
                if(outputPath != null){
                  filepath = outputPath + "/" + filepath;
                }
               
               
                if(encoding.equals("DER")){
                  FileOutputStream fos = new FileOutputStream(filepath);
                  fos.write(CertificateHelper.getCertificate(result.getData()).getEncoded());
                  fos.close();
                }else{
                  FileOutputStream fos = new FileOutputStream(filepath);
                  ArrayList<java.security.cert.Certificate> list = new ArrayList<java.security.cert.Certificate>();
                  list.add(CertificateHelper.getCertificate(result.getData()));
                  fos.write(CertTools.getPEMFromCerts(list));
                  fos.close();                                       
                }
                getPrintStream().println("Certificate generated, written to " + filepath);
              }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

            if(args.length == 7){
              outputPath = getOutputPath(args[ARG_OUTPUTPATH]);
            }
           
            try{
              CertificateResponse result = getEjbcaRAWS().pkcs10Request(username,password,pkcs10,hardtokensn,CertificateHelper.RESPONSETYPE_CERTIFICATE);
             
              if(result==null){
                getPrintStream().println("No certificate could be generated for user, check server logs for error.");
              }else{
                String filepath = username;
                if(encoding.equals("DER")){
                  filepath += ".cer";
                }else{
                  filepath += ".pem";
                }
                if(outputPath != null){
                  filepath = outputPath + "/" + filepath;
                }
               
               
                if(encoding.equals("DER")){
                  FileOutputStream fos = new FileOutputStream(filepath);
                  fos.write(CertificateHelper.getCertificate(result.getData()).getEncoded());
                  fos.close();
                }else{
                  FileOutputStream fos = new FileOutputStream(filepath);
                  ArrayList<java.security.cert.Certificate> list = new ArrayList<java.security.cert.Certificate>();
                  list.add(CertificateHelper.getCertificate(result.getData()));
                  fos.write(CertTools.getPEMFromCerts(list));
                  fos.close();                                       
                }
                getPrintStream().println("Certificate generated, written to " + filepath);
              }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.objects.CertificateResponse

      String crmf, String hardTokenSN, String responseType)
  throws CADoesntExistsException, AuthorizationDeniedException, NotFoundException, EjbcaException {

      final IPatternLogger logger = TransactionLogger.getPatternLogger();
      try {
          return new CertificateResponse(responseType, processCertReq(username, password,
                                                                      crmf, REQTYPE_CRMF, hardTokenSN, responseType, logger));
        } catch( CADoesntExistsException t ) {
            logger.paramPut(TransactionTags.ERROR_MESSAGE.toString(), t.toString());
            throw t;
        } catch( AuthorizationDeniedException t ) {
View Full Code Here

Examples of org.ejbca.core.protocol.ws.objects.CertificateResponse

      String spkac, String hardTokenSN, String responseType)
  throws CADoesntExistsException, AuthorizationDeniedException, NotFoundException, EjbcaException {

      final IPatternLogger logger = TransactionLogger.getPatternLogger();
      try {
          return new CertificateResponse(responseType, processCertReq(username, password,
                                                                      spkac, REQTYPE_SPKAC, hardTokenSN, responseType, logger));
        } catch( CADoesntExistsException t ) {
            logger.paramPut(TransactionTags.ERROR_MESSAGE.toString(), t.toString());
            throw t;
        } catch( AuthorizationDeniedException t ) {
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.