Package org.ejbca.core.protocol.ws.client.gen

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


            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

TOP

Related Classes of org.ejbca.core.protocol.ws.client.gen.CertificateResponse

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.