X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2Futil%2FCertExporter.java;h=06102fc006ba482fe31ae80074552c3829875e36;hp=cfe97ef2c847430711289e752837ddc41ca5f720;hb=0d53a31181ded3b9897179d3099ccb74a159d2cc;hpb=c4c60e1b9446e5ab69b8431ce71a2fbe11d47ef5 diff --git a/src/club/wpia/gigi/util/CertExporter.java b/src/club/wpia/gigi/util/CertExporter.java index cfe97ef2..06102fc0 100644 --- a/src/club/wpia/gigi/util/CertExporter.java +++ b/src/club/wpia/gigi/util/CertExporter.java @@ -14,6 +14,7 @@ import java.util.Set; import javax.servlet.ServletOutputStream; +import club.wpia.gigi.GigiApiException; import club.wpia.gigi.dbObjects.CACertificate; import club.wpia.gigi.dbObjects.Certificate; import sun.security.pkcs.ContentInfo; @@ -29,7 +30,7 @@ public class CertExporter { private CertExporter() {} - public static void writeCertCrt(Certificate c, ServletOutputStream out, boolean doChain, boolean includeAnchor, boolean includeLeaf) throws IOException, GeneralSecurityException { + public static void writeCertCrt(Certificate c, ServletOutputStream out, boolean doChain, boolean includeAnchor, boolean includeLeaf) throws IOException, GeneralSecurityException, GigiApiException { X509Certificate cert = c.cert(); if (includeLeaf) { out.println(PEM.encode("CERTIFICATE", cert.getEncoded())); @@ -46,7 +47,7 @@ public class CertExporter { } } - public static void writeCertCer(Certificate c, ServletOutputStream out, boolean doChain, boolean includeAnchor) throws IOException, GeneralSecurityException { + public static void writeCertCer(Certificate c, ServletOutputStream out, boolean doChain, boolean includeAnchor) throws IOException, GeneralSecurityException, GigiApiException { X509Certificate cert = c.cert(); if (doChain) { PKCS7 p7 = toP7Chain(c); @@ -56,7 +57,7 @@ public class CertExporter { } } - private static PKCS7 toP7Chain(Certificate c) throws IOException, GeneralSecurityException { + private static PKCS7 toP7Chain(Certificate c) throws IOException, GeneralSecurityException, GigiApiException { LinkedList ll = getChain(c); PKCS7 p7 = new PKCS7(new AlgorithmId[0], new ContentInfo(ContentInfo.DATA_OID, null), ll.toArray(new X509Certificate[ll.size()]), new SignerInfo[0]) { @@ -151,7 +152,7 @@ public class CertExporter { return p7; } - private static LinkedList getChain(Certificate c) throws IOException, GeneralSecurityException { + private static LinkedList getChain(Certificate c) throws IOException, GeneralSecurityException, GigiApiException { LinkedList ll = new LinkedList<>(); ll.add(c.cert()); CACertificate ca = c.getParent();