Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit b8c81c2

Browse files
committed
[FAB-7515] Adjust CA tests to match API
FAB-7223 modified the format of the CRL returned by various fabric-ca APIs. This change adjusts the HFCAClientIT to match this. Change-Id: I7b04f80207d3534b4ae863da486e576b3517f5bc Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
1 parent 270a75e commit b8c81c2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.io.BufferedInputStream;
1616
import java.io.ByteArrayInputStream;
1717
import java.io.File;
18+
import java.io.StringReader;
1819
import java.security.cert.CertificateException;
1920
import java.security.cert.CertificateFactory;
2021
import java.security.cert.CertificateParsingException;
@@ -28,9 +29,10 @@
2829
import java.util.regex.Matcher;
2930
import java.util.regex.Pattern;
3031

31-
import org.bouncycastle.asn1.ASN1InputStream;
3232
import org.bouncycastle.asn1.x509.CertificateList;
3333
import org.bouncycastle.asn1.x509.TBSCertList;
34+
import org.bouncycastle.cert.X509CRLHolder;
35+
import org.bouncycastle.openssl.PEMParser;
3436
import org.hyperledger.fabric.sdk.Enrollment;
3537
import org.hyperledger.fabric.sdk.security.CryptoSuite;
3638
import org.hyperledger.fabric.sdk.testutils.TestConfig;
@@ -498,10 +500,10 @@ TBSCertList.CRLEntry[] parseCRL(String crl) throws Exception {
498500
Base64.Decoder b64dec = Base64.getDecoder();
499501
final byte[] decode = b64dec.decode(crl.getBytes(UTF_8));
500502

501-
ByteArrayInputStream inStream = new ByteArrayInputStream(decode);
502-
ASN1InputStream asnInputStream = new ASN1InputStream(inStream);
503+
PEMParser pem = new PEMParser(new StringReader(new String(decode)));
504+
X509CRLHolder holder = (X509CRLHolder) pem.readObject();
503505

504-
return CertificateList.getInstance(asnInputStream.readObject()).getRevokedCertificates();
506+
return holder.toASN1Structure().getRevokedCertificates();
505507
}
506508

507509
@Test

0 commit comments

Comments
 (0)