-
Notifications
You must be signed in to change notification settings - Fork 139
PKI CA Java API
Chris Kelley edited this page Dec 14, 2022
·
2 revisions
To create a CA session:
CAClient caClient = new CAClient(client); AccountInfo accountInfo = caClient.login();
The AccountInfo contains information about the subsystem user (e.g. user ID, full name, email, roles).
To remove the session:
caClient.logout();
See also CAClient.java.
CertClient certClient = new CertClient(caClient);
CertDataInfos certInfos = certClient.findCerts(status, maxResults, maxTime, start, size); for (CertDataInfo certInfo : certInfos.getEntries()) { System.out.println("Cert ID: " + certInfo.getID()); System.out.println("Subject DN: " + certInfo.getSubjectDN()); System.out.println(); }
CertSearchRequest request = new CertSearchRequest(); request.setCommonName("CA Signing Certificate"); CertDataInfos certInfos = certClient.findCerts(request, start, size); for (CertDataInfo certInfo : certInfos.getEntries()) { System.out.println("Cert ID: " + certInfo.getID()); System.out.println("Subject DN: " + certInfo.getSubjectDN()); System.out.println(); }
CertData certData = certClient.getCert(id); System.out.println(certData.getEncoded());
CertData certData = certClient.reviewCert(id); CertRevokeRequest request = new CertRevokeRequest(); request.setReason(RevocationReason.CERTIFICATE_HOLD); request.setNonce(certData.getNonce()); CertRequestInfo requestInfo = certClient.revokeCert(id, request); System.out.println("Request status: " + requestInfo.getRequestStatus()); System.out.println("Operation result: " + requestInfo.getOperationResult()); System.out.println("Error message: " + requestInfo.getErrorMessage());
CertRequestInfo requestInfo = certClient.unrevokeCert(id); System.out.println("Request status: " + requestInfo.getRequestStatus()); System.out.println("Operation result: " + requestInfo.getOperationResult()); System.out.println("Error message: " + requestInfo.getErrorMessage());
ProfileDataInfos infos = certClient.listEnrollmentTemplates(start, size); for (ProfileDataInfo info : infos.getEntries()) { System.out.println("Profile ID: " + info.getProfileId()); }
CertEnrollmentRequest certRequest = certClient.getEnrollmentTemplate(profileID);
CertRequestInfos requestInfos = certClient.listRequests(status, type, startID, pageSize, maxResult, maxTime); for (CertRequestInfo requestInfo : requestInfos.getEntries()) { System.out.println("Request ID: " + requestInfo.getRequestId()); System.out.println(); }
CertRequestInfo requestInfo = certClient.getRequest(requestID); System.out.println("Request status: " + requestInfo.getRequestStatus());
CertEnrollmentRequest certRequest = certClient.getEnrollmentTemplate(profileID); ... <store profile inputs> ... CertRequestInfos requestInfos = certClient.enrollRequest(certRequest, authorityID, authorityDN); for (CertRequestInfo requestInfo : requestInfos.getEntries()) { System.out.println("Request ID: " + requestInfo.getRequestId()); }
CertReviewResponse reviewResponse = certClient.reviewRequest(requestID); certClient.approveRequest(requestID, reviewResponse);
CertReviewResponse reviewResponse = certClient.reviewRequest(requestID); certClient.rejectRequest(requestID, reviewResponse);
CertReviewResponse reviewResponse = certClient.reviewRequest(requestID); certClient.cancelRequest(requestID, reviewResponse);
CertReviewResponse reviewResponse = certClient.reviewRequest(requestID); certClient.updateRequest(requestID, reviewResponse);
CertReviewResponse reviewResponse = certClient.reviewRequest(requestID); certClient.validateRequest(requestID, reviewResponse);
CertReviewResponse reviewResponse = certClient.reviewRequest(requestID); certClient.assignRequest(requestID, reviewResponse);
Tip
|
To find a page in the Wiki, enter the keywords in search field, press Enter, then click Wikis. |