/** * Uploads a server certificate to AWS IAM. * * @param name The server certificate name. No spaces. * @param path Path to store the certificate under. * @param body PEM-encoded certificate body. * @param chain PEM-encoded certificate chain. * @param key PEM-encoded certificate key. * @return The server certificate ID of the uploaded certificate. */ public String uploadServerCertificate( final String name, final String path, final String body, final String chain, final String key) { final UploadServerCertificateRequest request = new UploadServerCertificateRequest() .withServerCertificateName(name) .withPath(sanitizePath(path)) .withCertificateBody(body) .withCertificateChain(chain) .withPrivateKey(key); final UploadServerCertificateResult result = client.uploadServerCertificate(request); return result.getServerCertificateMetadata().getServerCertificateId(); }
public String loadSSLCertificate( String certificateName, String certificate, String privateKey, String path){ String certificateId = this.getCertificateId(certificateName); if(certificateId==null){ UploadServerCertificateRequest certificateRequest = new UploadServerCertificateRequest( certificateName, certificate, privateKey); certificateRequest.setPath(path); UploadServerCertificateResult uploadServerCertificate = getIdentityClient().uploadServerCertificate(certificateRequest); certificateId = uploadServerCertificate.getServerCertificateMetadata().getServerCertificateId(); } return certificateId; }
public ServerCertificate createServerCert(UploadServerCertificateRequest request) throws InterruptedException { logger.info("create server cert, path={}, name={}", request.getPath(), request.getServerCertificateName()); UploadServerCertificateResult result = iam.uploadServerCertificate(request); return new ServerCertificate(result.getServerCertificateMetadata(), request.getCertificateBody()) .withCertificateChain(request.getCertificateChain()); }