Skip to content

Commit

Permalink
[FAB-7515] Adjust CA tests to match API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mastersingh24 committed Dec 19, 2017
1 parent 270a75e commit b8c81c2
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.StringReader;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.CertificateParsingException;
Expand All @@ -28,9 +29,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.x509.CertificateList;
import org.bouncycastle.asn1.x509.TBSCertList;
import org.bouncycastle.cert.X509CRLHolder;
import org.bouncycastle.openssl.PEMParser;
import org.hyperledger.fabric.sdk.Enrollment;
import org.hyperledger.fabric.sdk.security.CryptoSuite;
import org.hyperledger.fabric.sdk.testutils.TestConfig;
Expand Down Expand Up @@ -498,10 +500,10 @@ TBSCertList.CRLEntry[] parseCRL(String crl) throws Exception {
Base64.Decoder b64dec = Base64.getDecoder();
final byte[] decode = b64dec.decode(crl.getBytes(UTF_8));

ByteArrayInputStream inStream = new ByteArrayInputStream(decode);
ASN1InputStream asnInputStream = new ASN1InputStream(inStream);
PEMParser pem = new PEMParser(new StringReader(new String(decode)));
X509CRLHolder holder = (X509CRLHolder) pem.readObject();

return CertificateList.getInstance(asnInputStream.readObject()).getRevokedCertificates();
return holder.toASN1Structure().getRevokedCertificates();
}

@Test
Expand Down

0 comments on commit b8c81c2

Please sign in to comment.