From: James Moger Date: Fri, 23 Nov 2012 23:18:02 +0000 (-0500) Subject: Eliminate internal Sun api for CRLs and include X509 tests in suite X-Git-Tag: v1.2.0~78 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f185d956682e96272b5a74db6b2b208f467bcdb6;p=gitblit.git Eliminate internal Sun api for CRLs and include X509 tests in suite --- diff --git a/Gitblit.iml b/Gitblit.iml deleted file mode 100644 index 2efe6cfd..00000000 --- a/Gitblit.iml +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gitblit.iml b/gitblit.iml new file mode 100644 index 00000000..12f69f38 --- /dev/null +++ b/gitblit.iml @@ -0,0 +1,373 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/gitblit/utils/X509Utils.java b/src/com/gitblit/utils/X509Utils.java index e27d7bc8..3caff358 100644 --- a/src/com/gitblit/utils/X509Utils.java +++ b/src/com/gitblit/utils/X509Utils.java @@ -21,6 +21,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Field; import java.math.BigInteger; import java.security.InvalidKeyException; @@ -36,6 +37,7 @@ import java.security.cert.CertPathBuilder; import java.security.cert.CertPathBuilderException; import java.security.cert.CertStore; import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; import java.security.cert.CollectionCertStoreParameters; import java.security.cert.PKIXBuilderParameters; import java.security.cert.PKIXCertPathBuilderResult; @@ -82,8 +84,6 @@ import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import sun.security.x509.X509CRLImpl; - import com.gitblit.Constants; /** @@ -1034,13 +1034,22 @@ public class X509Utils { if (!caRevocationList.exists()) { return false; } + InputStream inStream = null; try { - byte [] data = FileUtils.readContent(caRevocationList); - X509CRL crl = new X509CRLImpl(data); + inStream = new FileInputStream(caRevocationList); + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + X509CRL crl = (X509CRL)cf.generateCRL(inStream); return crl.isRevoked(cert); } catch (Exception e) { logger.error(MessageFormat.format("Failed to check revocation status for certificate {0,number,0} [{1}] in {2}", cert.getSerialNumber(), cert.getSubjectDN().getName(), caRevocationList)); + } finally { + if (inStream != null) { + try { + inStream.close(); + } catch (Exception e) { + } + } } return false; } diff --git a/tests/com/gitblit/tests/GitBlitSuite.java b/tests/com/gitblit/tests/GitBlitSuite.java index 3527d583..bb734eb7 100644 --- a/tests/com/gitblit/tests/GitBlitSuite.java +++ b/tests/com/gitblit/tests/GitBlitSuite.java @@ -57,7 +57,7 @@ import com.gitblit.utils.JGitUtils; StringUtilsTest.class, Base64Test.class, JsonUtilsTest.class, ByteFormatTest.class, ObjectCacheTest.class, PermissionsTest.class, UserServiceTest.class, LdapUserServiceTest.class, MarkdownUtilsTest.class, JGitUtilsTest.class, SyndicationUtilsTest.class, - DiffUtilsTest.class, MetricUtilsTest.class, TicgitUtilsTest.class, + DiffUtilsTest.class, MetricUtilsTest.class, TicgitUtilsTest.class, X509UtilsTest.class, GitBlitTest.class, FederationTests.class, RpcTests.class, GitServletTest.class, GroovyScriptTest.class, LuceneExecutorTest.class, IssuesTest.class, RepositoryModelTest.class }) public class GitBlitSuite {