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();
}
Aggregations