List of usage examples for java.security SecureRandom nextInt
public int nextInt()
From source file:acp.sdk.SecureUtil.java
/** * //www . j a v a 2 s .c o m * @param aBytesText * @param aBlockSize * @return */ private static byte[] addPKCS1Padding(byte[] aBytesText, int aBlockSize) { if (aBytesText.length > (aBlockSize - 3)) { return null; } SecureRandom tRandom = new SecureRandom(); byte[] tAfterPaddingBytes = new byte[aBlockSize]; tRandom.nextBytes(tAfterPaddingBytes); tAfterPaddingBytes[0] = 0x00; tAfterPaddingBytes[1] = 0x02; int i = 2; for (; i < aBlockSize - 1 - aBytesText.length; i++) { if (tAfterPaddingBytes[i] == 0x00) { tAfterPaddingBytes[i] = (byte) tRandom.nextInt(); } } tAfterPaddingBytes[i] = 0x00; System.arraycopy(aBytesText, 0, tAfterPaddingBytes, (i + 1), aBytesText.length); return tAfterPaddingBytes; }
From source file:org.wso2.carbon.cloud.gateway.transport.server.CGThriftServerHandler.java
/** * Allow access to user userName for the buffer queueName and return the token or throw * exception if user can't allow access to the buffer * * @param userName user name of the client * @param password password of the client * @param queueName the name of the buffer to use should allow access to * @return a token to use for server buffer access * @throws NotAuthorizedException throws in case of illegal access * @throws TException throws in case of an connection error *//* w w w . ja va2s . c om*/ public String login(String userName, String password, String queueName) throws NotAuthorizedException, TException { // check if this user is configured AuthenticationAdmin authAdmin = new AuthenticationAdmin(); try { if (!authAdmin.login(userName, password, "localhost")) { throw new NotAuthorizedException("User '" + userName + "' not authorized to access" + " buffers"); } } catch (AuthenticationException e) { throw new NotAuthorizedException(e.getMessage()); } SecureRandom rand = new SecureRandom(); String token = Integer.toString(rand.nextInt()); if (authorizedQueues.containsKey(queueName)) { // an already authorized user try to login again let him/her login again String oldToken = authorizedQueues.get(queueName); authorizedQueues.remove(queueName); if (requestBuffers.containsKey(oldToken)) { BlockingQueue<Message> oldBuffer = requestBuffers.remove(oldToken); // initialize the new buffer with the existing messages requestBuffers.put(token, new LinkedBlockingQueue<Message>(oldBuffer)); } } else { // initialize the buffer for this request requestBuffers.put(token, new LinkedBlockingQueue<Message>()); } authorizedQueues.put(queueName, token); return token; }
From source file:org.gc.googleAnalytics.AuthHelper.java
/** * Generates a secure state token.// ww w .j a v a 2 s .c om */ private void generateStateToken() { SecureRandom sr1 = new SecureRandom(); stateToken = "google;" + sr1.nextInt(); }
From source file:org.vasanti.controller.ImageUploader.java
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request/* www.j a v a 2 s. co m*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); String path = ""; if (!ServletFileUpload.isMultipartContent(request)) { throw new IllegalArgumentException( "Request is not multipart, please 'multipart/form-data' enctype for your form."); } bnimagesbn images = new bnimagesbn(); ServletFileUpload uploadHandler = new ServletFileUpload(new DiskFileItemFactory()); response.setContentType("application/json"); JSONObject files = new JSONObject(); try { List<FileItem> items = uploadHandler.parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { FileItem colpostid = (FileItem) items.get(0); String COLPOSTID = colpostid.getString(); if (COLPOSTID != null) { images.setCOLPOSTID(COLPOSTID); logger.info("COLPOSTID from View is = " + COLPOSTID); } else if (COLPOSTID == null) { status = false; String error = "Listing Id is empty"; files.put("status", status); files.put("error", error); } } else if (!item.isFormField()) { String ImageName = ""; String name = item.getName(); String contentType = item.getContentType(); logger.info("Content Type of file is " + contentType); long size = item.getSize(); logger.info("Size of file is " + size); String filetype = name.substring(name.lastIndexOf(".")); SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); String randomNum = Integer.toString(prng.nextInt()); MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] result = sha.digest(randomNum.getBytes()); ImageName = hexEncode(result) + filetype; logger.info(" ImageName1 is " + ImageName); if (name != null) { if ((size < 9048576) && (("image/jpeg".equals(contentType)) || ("image/jpg".equals(contentType)) || ("image/gif".equals(contentType)) || ("image/png".equals(contentType)) || ("image/bmp".equals(contentType)))) { images.setCOLIMAGENAME(ImageName); } } else if (name == null) { // Update the error status since file name is null status = false; String error = "Image name is empty "; files.put("status", status); files.put("error", error); } File file = new File(ImagefileUploadPath, ImageName); item.write(file); path = file.getCanonicalPath(); logger.info(" ImageName1 CanonicalPath is " + path); BufferedImage img = null; try { img = ImageIO.read((new File(path))); } catch (IOException ex) { logger.error("Logging IO Exception while creating thumbnail", ex); } BufferedImage thumbImg = Scalr.resize(img, Scalr.Method.QUALITY, Scalr.Mode.AUTOMATIC, 150, 150, Scalr.OP_ANTIALIAS); File thumbnailfile = new File(ThumbnailFileUploadPath, ImageName); images.setCOLTHUMBNAILNAME(ImageName); ImageIO.write(thumbImg, "jpg", thumbnailfile); files.put("name", ImageName); InsertImageInterface insert = new InsertImageInterface(); count = insert.InsertImage(images); if (count > 0) { status = true; files.put("status", status); files.put("count", count); } logger.info(files.toString()); } } } catch (FileUploadException ex) { try { logger.error("Got the FileUpload Exception", ex); String error = "Some error has occurred"; files.put("error", error); } catch (JSONException ex1) { logger.error("Got the JsonException", ex1); } } catch (Exception ex) { logger.error("Got the Exception", ex); } finally { try { files.put("status", status); writer.write(files.toString()); writer.close(); } catch (JSONException ex) { logger.error("Got the JSONException", ex); } } }
From source file:com.aimluck.eip.util.ALCommonUtils.java
/** * ???????/*from w ww .j a v a 2 s . c o m*/ * * @return */ public int getImageRandomNumber() { SecureRandom random = new SecureRandom(); return (random.nextInt() * 100); }
From source file:org.vasanti.controller.UploadServlet.java
/** * @param request/*from w ww .j a va2s . c o m*/ * @param response * @throws javax.servlet.ServletException * @throws java.io.IOException * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) * */ @SuppressWarnings("unchecked") @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); String path = ""; if (!ServletFileUpload.isMultipartContent(request)) { throw new IllegalArgumentException( "Request is not multipart, please 'multipart/form-data' enctype for your form."); } bnimagesbn images = new bnimagesbn(); ServletFileUpload uploadHandler = new ServletFileUpload(new DiskFileItemFactory()); response.setContentType("application/json"); JSONArray json = new JSONArray(); JSONObject files = new JSONObject(); try { List<FileItem> items = uploadHandler.parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { FileItem colpostid = (FileItem) items.get(0); String COLPOSTID = colpostid.getString(); if (COLPOSTID != null) { images.setCOLPOSTID(COLPOSTID); logger.info("COLPOSTID from View is = " + COLPOSTID); } else if (COLPOSTID == null) { RequestDispatcher rd = request .getRequestDispatcher("/WEB-INF/views/services/error-page.jsp"); rd.forward(request, response); } } else if (!item.isFormField()) { String ImageName = ""; String name = item.getName(); String contentType = item.getContentType(); logger.info("Content Type of file is", contentType); long size = item.getSize(); logger.info("Size of file is", size); String filetype = name.substring(name.lastIndexOf(".")); SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); String randomNum = Integer.toString(prng.nextInt()); MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] result = sha.digest(randomNum.getBytes()); ImageName = hexEncode(result) + filetype; logger.info(" ImageName1 is " + ImageName); if (name != null) { if ((size < 9048576) && (("image/jpeg".equals(contentType)) || ("image/jpg".equals(contentType)) || ("image/gif".equals(contentType)) || ("image/png".equals(contentType)) || ("image/bmp".equals(contentType)))) { images.setCOLIMAGENAME(ImageName); } } else if (name == null) { RequestDispatcher rd = request .getRequestDispatcher("/WEB-INF/views/adultservices/error-page.jsp"); rd.forward(request, response); } File file = new File(ImagefileUploadPath, ImageName); item.write(file); path = file.getCanonicalPath(); logger.info(" ImageName1 CanonicalPath is " + path); BufferedImage img = null; try { img = ImageIO.read((new File(path))); } catch (IOException ex) { logger.error("Logging IO Exception while creating thumbnail", ex); } BufferedImage thumbImg = Scalr.resize(img, Method.QUALITY, Mode.AUTOMATIC, 150, 150, Scalr.OP_ANTIALIAS); File thumbnailfile = new File(ThumbnailFileUploadPath, ImageName); images.setCOLTHUMBNAILNAME(ImageName); ImageIO.write(thumbImg, "jpg", thumbnailfile); JSONObject jsono = new JSONObject(); jsono.put("name", ImageName); jsono.put("size", item.getSize()); jsono.put("url", "UploadServlet?getfile=" + ImageName); jsono.put("thumbnail_url", "UploadServlet?getthumb=" + ImageName); jsono.put("delete_url", "UploadServlet?delfile=" + ImageName); jsono.put("delete_type", "GET"); json.put(jsono); InsertImageInterface insert = new InsertImageInterface(); insert.InsertImage(images); files.put("files", json); logger.info(json.toString()); } } } catch (FileUploadException ex) { logger.error("Got the FileUpload Exception", ex); } catch (Exception ex) { logger.error("Got the Exception", ex); } finally { writer.write(json.toString()); writer.close(); } }
From source file:org.vasanti.controller.DropZoneFileUpload.java
/** * @param request/*from w w w . java 2 s . co m*/ * @param response * @throws javax.servlet.ServletException * @throws java.io.IOException * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) * */ @SuppressWarnings("unchecked") @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); String path = ""; if (!ServletFileUpload.isMultipartContent(request)) { throw new IllegalArgumentException( "Request is not multipart, please 'multipart/form-data' enctype for your form."); } bnimagesbn images = new bnimagesbn(); ServletFileUpload uploadHandler = new ServletFileUpload(new DiskFileItemFactory()); response.setContentType("application/json"); JSONObject files = new JSONObject(); try { List<FileItem> items = uploadHandler.parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { FileItem colpostid = (FileItem) items.get(0); String COLPOSTID = colpostid.getString(); if (COLPOSTID != null) { images.setCOLPOSTID(COLPOSTID); logger.info("COLPOSTID from View is = " + COLPOSTID); } else if (COLPOSTID == null) { RequestDispatcher rd = request .getRequestDispatcher("/WEB-INF/views/services/error-page.jsp"); rd.forward(request, response); } } else if (!item.isFormField()) { String ImageName = ""; String name = item.getName(); String contentType = item.getContentType(); logger.info("Content Type of file is " + contentType); long size = item.getSize(); logger.info("Size of file is " + size); String filetype = name.substring(name.lastIndexOf(".")); SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); String randomNum = Integer.toString(prng.nextInt()); MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] result = sha.digest(randomNum.getBytes()); ImageName = hexEncode(result) + filetype; logger.info(" ImageName1 is " + ImageName); if (name != null) { if ((size < 9048576) && (("image/jpeg".equals(contentType)) || ("image/jpg".equals(contentType)) || ("image/gif".equals(contentType)) || ("image/png".equals(contentType)) || ("image/bmp".equals(contentType)))) { images.setCOLIMAGENAME(ImageName); } } else if (name == null) { RequestDispatcher rd = request .getRequestDispatcher("/WEB-INF/views/adultservices/error-page.jsp"); rd.forward(request, response); } File file = new File(ImagefileUploadPath, ImageName); item.write(file); path = file.getCanonicalPath(); logger.info(" ImageName1 CanonicalPath is " + path); BufferedImage img = null; try { img = ImageIO.read((new File(path))); } catch (IOException ex) { logger.error("Logging IO Exception while creating thumbnail", ex); } BufferedImage thumbImg = Scalr.resize(img, Method.QUALITY, Mode.AUTOMATIC, 150, 150, Scalr.OP_ANTIALIAS); File thumbnailfile = new File(ThumbnailFileUploadPath, ImageName); images.setCOLTHUMBNAILNAME(ImageName); ImageIO.write(thumbImg, "jpg", thumbnailfile); files.put("name", ImageName); // jsono.put("size", item.getSize()); // jsono.put("url", "UploadServlet?getfile=" + ImageName); // jsono.put("thumbnail_url", "UploadServlet?getthumb=" + ImageName); // jsono.put("delete_url", "UploadServlet?delfile=" + ImageName); // jsono.put("delete_type", "GET"); InsertImageInterface insert = new InsertImageInterface(); count = insert.InsertImage(images); files.put("status", status); logger.info(files.toString()); } } } catch (FileUploadException ex) { logger.error("Got the FileUpload Exception", ex); } catch (Exception ex) { logger.error("Got the Exception", ex); } finally { try { files.put("status", status); writer.write(files.toString()); writer.close(); } catch (JSONException ex) { logger.error("Got the JSONException", ex); } } }
From source file:org.openhie.openempi.recordlinkage.protocols.ThreeThirdPartyPRLProtocolBase.java
public void testPMLinkRecords(int leftDatasetId, int rightDatasetId, String blockingServiceName, String matchingServiceName) throws ApplicationException { long startTime = System.currentTimeMillis(); log.warn("PAM EM calculation Start: " + startTime); SecureRandom rnd = new SecureRandom(); PersonManagerService personManagerService = Context.getPersonManagerService(); Dataset leftDataset = personManagerService.getDatasetById(leftDatasetId); int leftNonce = rnd.nextInt(); DiffieHellmanKeyExchange dhkeLeft = new DiffieHellmanKeyExchange(leftNonce); BigInteger dhPublicKeyLeft = dhkeLeft.computePublicKey(); PersonMatchRequest leftPersonMatchRequest = createPersonMatchRequest(leftDataset, dhPublicKeyLeft.toByteArray(), Constants.LOCALHOST_IP_ADDRESS, blockingServiceName, matchingServiceName);//from ww w. j a v a 2 s. c o m leftPersonMatchRequest = personMatchRequestDao.addPersonMatchRequest(leftPersonMatchRequest); Dataset rightDataset = personManagerService.getDatasetById(rightDatasetId); int rightNonce = rnd.nextInt(); DiffieHellmanKeyExchange dhkeRight = new DiffieHellmanKeyExchange(rightNonce); BigInteger dhPublicKeyRight = dhkeRight.computePublicKey(); PersonMatchRequest rightPersonMatchRequest = createPersonMatchRequest(rightDataset, dhPublicKeyRight.toByteArray(), Constants.LOCALHOST_IP_ADDRESS, blockingServiceName, matchingServiceName); rightPersonMatchRequest = personMatchRequestDao.addPersonMatchRequest(rightPersonMatchRequest); linkRecords(leftPersonMatchRequest, rightPersonMatchRequest, ComponentType.PARAMETER_MANAGER_MODE, null); long endTime = System.currentTimeMillis(); log.warn("PAM EM calculation End: " + endTime + ", elapsed: " + (endTime - startTime)); }
From source file:org.moe.document.pbxproj.ProjectFile.java
private String generateReference() { MessageDigest md;/* ww w . j a v a 2s .c o m*/ SecureRandom prng; try { md = MessageDigest.getInstance("SHA1"); prng = SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Random generator failed", e); } String randomNum = Integer.toString(prng.nextInt()); String ref = new String(Hex.encodeHex(md.digest(randomNum.getBytes()))); return ref.toUpperCase().substring(0, 24); }
From source file:org.ejbca.ui.web.admin.configuration.StartServicesServlet.java
@SuppressWarnings("deprecation") private void ejbcaInit() { ////from w ww . j a v a 2 s. co m // Run all "safe" initializations first, // i.e. those that does not depend on other running beans, components etc // Log a startup message String iMsg = intres.getLocalizedMessage("startservice.startup", GlobalConfiguration.EJBCA_VERSION); log.info(iMsg); // Reinstall BC-provider to help re-deploys to work log.trace(">init re-installing BC-provider"); CryptoProviderTools.removeBCProvider(); CryptoProviderTools.installBCProvider(); // Run java seed collector, that can take a little time the first time it is run log.trace(">init initializing random seed"); SecureRandom rand = new SecureRandom(); rand.nextInt(); // // Start services that requires calling other beans or components // // We really need BC to be installed. This is an attempt to fix a bug where the ServiceSessionBean // crashes from not finding the BC-provider. int waitTime = 0; while (Security.getProvider("BC") == null && waitTime++ < 5) { log.info("Waiting for BC provider to be installed.."); try { Thread.sleep(2000); } catch (InterruptedException e) { log("Waiting for BC provider failed.", e); break; } } // We have to read CAs into cache (and upgrade them) early, because the log system may use CAs for signing logs log.trace(">init CryptoTokenFactory just to load those classes that are available"); CryptoTokenFactory.instance(); // Load CAs at startup to improve impression of speed the first time a CA is accessed, it takes a little time to load it. log.trace(">init loading CAs into cache"); try { caAdminSession.initializeAndUpgradeCAs(); } catch (Exception e) { log.error("Error creating CAAdminSession: ", e); } AuthenticationToken admin = new AlwaysAllowLocalAuthenticationToken( new UsernamePrincipal("StartServicesServlet.init")); // Make a log row that EJBCA is starting Map<String, Object> details = new LinkedHashMap<String, Object>(); details.put("msg", iMsg); logSession.log(EjbcaEventTypes.EJBCA_STARTING, EventStatus.SUCCESS, EjbcaModuleTypes.SERVICE, EjbcaServiceTypes.EJBCA, admin.toString(), null, getHostName(), null, details); // Log the type of security audit configuration that we have enabled. log.trace(">init security audit device configuration"); final Set<String> loggerIds = AuditDevicesConfig.getAllDeviceIds(); if (loggerIds.isEmpty()) { final String msg = intres.getLocalizedMessage("startservices.noauditdevices"); log.info(msg); } else { if (!checkForProtectedAudit(admin, loggerIds)) { // Make a log row that no integrity protected device is configured final String msg = intres.getLocalizedMessage("startservices.noprotectedauditdevices"); final Map<String, Object> logdetails = new LinkedHashMap<String, Object>(); logdetails.put("msg", msg); logSession.log(EventTypes.LOG_MANAGEMENT_CHANGE, EventStatus.VOID, ModuleTypes.SECURITY_AUDIT, ServiceTypes.CORE, admin.toString(), null, null, null, logdetails); } } // Initialize authorization system, if not done already log.trace(">init ComplexAccessControlSession to check for initial root role"); complexAccessControlSession.initializeAuthorizationModule(); log.trace(">init calling ServiceSession.load"); try { serviceSession.load(); } catch (Exception e) { log.error("Error init ServiceSession: ", e); } // Load Certificate profiles at startup to upgrade them if needed log.trace(">init loading CertificateProfile to check for upgrades"); try { certificateProfileSession.initializeAndUpgradeProfiles(); } catch (Exception e) { log.error("Error initializing certificate profiles: ", e); } // Load EndEntity profiles at startup to upgrade them if needed // And add this node to list of nodes log.trace(">init loading EndEntityProfile to check for upgrades"); try { endEntityProfileSession.initializeAndUpgradeProfiles(); } catch (Exception e) { log.error("Error initializing end entity profiles: ", e); } // Add this node's hostname to list of nodes log.trace(">init checking if this node is in the list of nodes"); try { // Requires a transaction in order to create the initial global configuration tx.begin(); try { final GlobalConfiguration config = (GlobalConfiguration) globalConfigurationSession .getCachedConfiguration(GlobalConfiguration.GLOBAL_CONFIGURATION_ID); final Set<String> nodes = config.getNodesInCluster(); final String hostname = getHostName(); if (hostname != null && !nodes.contains(hostname)) { log.debug("Adding this node (" + hostname + ") to the list of nodes"); nodes.add(hostname); config.setNodesInCluster(nodes); globalConfigurationSession.saveConfiguration(admin, config); } } finally { tx.commit(); } } catch (Exception e) { log.error("Error adding host to node list in global configuration: ", e); } log.trace(">init SignSession to check for unique issuerDN,serialNumber index"); // Call the check for unique index, since first invocation will perform the database // operation and avoid a performance hit for the first request where this is checked. certCreateSession.isUniqueCertificateSerialNumberIndex(); /* * FIXME: This is a hack, because we need some sort of annotation or service loader to make sure * that the AccessMatchValue-implementing enums get initialized at runtime. Sadly, enums aren't * initialized until they're called, which causes trouble with this registry. * * These lines are to be removed once a dynamic initialization heuristic has been developed. * */ try { Class.forName(X500PrincipalAccessMatchValue.class.getName()); Class.forName(CliUserAccessMatchValue.class.getName()); } catch (ClassNotFoundException e) { log.error("Failure during match value initialization", e); } // Check if there the default responder has been set. If not, try setting it using the old value. GlobalOcspConfiguration globalConfiguration = (GlobalOcspConfiguration) globalConfigurationSession .getCachedConfiguration(GlobalOcspConfiguration.OCSP_CONFIGURATION_ID); if (StringUtils.isEmpty(globalConfiguration.getOcspDefaultResponderReference())) { globalConfiguration.setOcspDefaultResponderReference(OcspConfiguration.getDefaultResponderId()); try { globalConfigurationSession.saveConfiguration(admin, globalConfiguration); globalConfigurationSession.flushConfigurationCache(GlobalOcspConfiguration.OCSP_CONFIGURATION_ID); } catch (AuthorizationDeniedException e) { throw new IllegalStateException( "An always allow token was not allowed access. Likely cause is that the database hasn't been configured."); } } // Upgrade the old Validation Authority Publisher in Community Edition (leave it be in Enterprise for the sake of 100% uptime) if (!enterpriseEditionEjbBridgeSession.isRunningEnterprise()) { publisherSession.adhocUpgradeTo6_3_1_1(); } // Check and upgrade if this is the first time we start an instance that was previously an stand-alone VA ocspResponseGeneratorSession.adhocUpgradeFromPre60(null); // Start key reload timer ocspResponseGeneratorSession.initTimers(); // Start CA certificate cache reload certificateStoreSession.initTimers(); // Verify that the EJB CLI user (if present) cannot be used to generate certificates final String cliUsername = EjbcaConfiguration.getCliDefaultUser(); try { final EndEntityInformation defaultCliUser = endEntityAccessSession.findUser(admin, cliUsername); if (defaultCliUser != null && defaultCliUser.getStatus() == EndEntityConstants.STATUS_NEW) { try { endEntityManagementSession.setUserStatus(admin, cliUsername, EndEntityConstants.STATUS_GENERATED); } catch (ApprovalException e) { log.warn("The EJBCA CLI user '" + cliUsername + "' could be used for certificate enrollment. Please correct the status manually. Failed with: " + e.getMessage()); } catch (FinderException e) { log.warn("The EJBCA CLI user '" + cliUsername + "' could be used for certificate enrollment. Please correct the status manually. Failed with: " + e.getMessage()); } catch (WaitingForApprovalException e) { log.warn("The EJBCA CLI user '" + cliUsername + "' could be used for certificate enrollment. Please correct the status manually. Failed with: " + e.getMessage()); } } } catch (AuthorizationDeniedException e) { log.warn("Unable to check if the EJBCA CLI user '" + cliUsername + "' could be used for certificate enrollment. Please check and correct the status manually. Failed with: " + e.getMessage()); } }