Search in sources :

Example 1 with CertificateSignRequest

use of org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest in project ozone by apache.

the class ReconUtils method getCSR.

/**
 * Creates CertificateSignRequest.
 * @param config
 */
public static PKCS10CertificationRequest getCSR(OzoneConfiguration config, CertificateClient certClient) throws IOException {
    CertificateSignRequest.Builder builder = certClient.getCSRBuilder();
    KeyPair keyPair = new KeyPair(certClient.getPublicKey(), certClient.getPrivateKey());
    String hostname = InetAddress.getLocalHost().getCanonicalHostName();
    String subject = UserGroupInformation.getCurrentUser().getShortUserName() + "@" + hostname;
    builder.setCA(false).setKey(keyPair).setConfiguration(config).setSubject(subject);
    return builder.build();
}
Also used : KeyPair(java.security.KeyPair) CertificateSignRequest(org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest)

Aggregations

KeyPair (java.security.KeyPair)1 CertificateSignRequest (org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest)1