Galsza commented on code in PR #4231:
URL: https://github.com/apache/ozone/pull/4231#discussion_r1108632616


##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/security/x509/certificate/utils/TestCertificateCodec.java:
##########
@@ -104,6 +94,50 @@ public void testGetPEMEncodedString()
     assertEquals(firstCert, secondCert);
   }
 
+  /**
+   * Test when converting a certificate path to pem encoded string and back
+   * we get back the same certificates.
+   */
+  @Test
+  public void testGetPemEncodedStringFromCertPath() throws IOException,
+      NoSuchAlgorithmException, NoSuchProviderException, CertificateException {
+    X509CertificateHolder certHolder1 = generateTestCert();
+    X509CertificateHolder certHolder2 = generateTestCert();
+    X509Certificate cert1 = CertificateCodec.getX509Certificate(certHolder1);
+    X509Certificate cert2 = CertificateCodec.getX509Certificate(certHolder2);
+    CertificateFactory certificateFactory = new CertificateFactory();
+    CertPath pathToEncode =
+        certificateFactory.engineGenerateCertPath(ImmutableList.of(cert1,
+            cert2));
+    String encodedPath = CertificateCodec.getPEMEncodedString(pathToEncode);

Review Comment:
   Created a sub task for this issue: 
[HDDS-7981](https://issues.apache.org/jira/browse/HDDS-7981)



-- 
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