yandrey321 commented on code in PR #12114:
URL: https://github.com/apache/ozone/pull/12114#discussion_r4683789949


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateApprover.java:
##########
@@ -64,6 +64,31 @@ X509Certificate sign(
       String scmId,
       String clusterId,
       String certSerialId)
+      throws IOException, CertificateException {
+    return sign(config, caPrivate, caCertificate, validFrom, validTill, 
certificationRequest, scmId, clusterId,
+        certSerialId, null);
+  }
+
+  /**
+   * Like {@link #sign(SecurityConfig, PrivateKey, X509Certificate, Date, 
Date, PKCS10CertificationRequest, String,
+   * String, String)}, with the commonName to use instead of the CSR's when 
that is longer than RFC 5280
+   * ub-common-name, as in a CSR from a client that predates
+   * {@link 
org.apache.hadoop.hdds.security.x509.certificate.utils.CertificateSignRequest#commonName}.
+   *
+   * @param commonNameIfTooLong - commonName for a CSR commonName longer than 
64 characters, or null to keep it.
+   */
+  @SuppressWarnings("ParameterNumber")
+  X509Certificate sign(
+      SecurityConfig config,
+      PrivateKey caPrivate,
+      X509Certificate caCertificate,
+      Date validFrom,
+      Date validTill,
+      PKCS10CertificationRequest certificationRequest,
+      String scmId,
+      String clusterId,
+      String certSerialId,
+      String commonNameIfTooLong)

Review Comment:
   fixed



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/authority/CertificateServer.java:
##########
@@ -91,10 +91,23 @@ X509Certificate getCertificate(String certSerialId)
    * approved.
    * @throws SCMSecurityException - on Error.
    */
+  default Future<CertPath> requestCertificate(
+      PKCS10CertificationRequest csr,
+      CertificateApprover.ApprovalType type, NodeType role,
+      String certSerialId) throws SCMSecurityException {
+    return requestCertificate(csr, type, role, certSerialId, null);
+  }
+
+  /**
+   * Like {@link #requestCertificate(PKCS10CertificationRequest, 
CertificateApprover.ApprovalType, NodeType, String)},
+   * with the commonName to issue instead of the CSR's when that is longer 
than RFC 5280 ub-common-name.
+   *
+   * @param commonNameIfTooLong - commonName for a CSR commonName longer than 
64 characters, or null to keep it.
+   */
   Future<CertPath> requestCertificate(
       PKCS10CertificationRequest csr,
       CertificateApprover.ApprovalType type, NodeType role,
-      String certSerialId) throws SCMSecurityException;
+      String certSerialId, String commonNameIfTooLong) throws 
SCMSecurityException;

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to