]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/CertExporter.java
add: make inclusion of leaf certificate optional
[gigi.git] / src / org / cacert / gigi / util / CertExporter.java
index 6c1809795d6698312aac7e9865b8b74b3c293b60..c227f09c4c1f041f0d7c8a57197c44db232427c0 100644 (file)
@@ -30,9 +30,11 @@ public class CertExporter {
 
     private CertExporter() {}
 
-    public static void writeCertCrt(Certificate c, ServletOutputStream out, boolean doChain, boolean includeAnchor) throws IOException, GeneralSecurityException {
+    public static void writeCertCrt(Certificate c, ServletOutputStream out, boolean doChain, boolean includeAnchor, boolean includeLeaf) throws IOException, GeneralSecurityException {
         X509Certificate cert = c.cert();
-        out.println(PEM.encode("CERTIFICATE", cert.getEncoded()));
+        if (includeLeaf) {
+            out.println(PEM.encode("CERTIFICATE", cert.getEncoded()));
+        }
         if (doChain) {
             CACertificate ca = c.getParent();
             while ( !ca.isSelfsigned()) {