source: core/java/test/scalatest/net/i2p/crypto/CertUtilSpec.scala @ e8ac24b

Last change on this file since e8ac24b was e8ac24b, checked in by meeh <meeh@…>, 3 years ago

Added some missing files from earlier commits caused by -R stuff in mtn.

  • Property mode set to 100644
File size: 969 bytes
Line 
1package net.i2p.crypto
2
3import java.io.File
4import java.security.cert.X509Certificate
5
6import org.scalatest.FunSpec
7import org.scalatest.Matchers
8
9
10class CertUtilSpec extends FunSpec with Matchers {
11
12  describe("CertUtil") {
13    // For some stupid gradle issues, it don't copies reosurces. So hacky way.
14    // When added to junit directory, it get copied. Until a better way is found,
15    // this is the non-optimal solution.
16    val certFileUrl = getClass.getResource("/resources/meeh_at_mail.i2p.crt")
17    val certFile = new File(certFileUrl.toURI)
18
19    it("should be able to read a certificate") {
20      val cert: X509Certificate = CertUtil.loadCert(certFile)
21      assert(cert.getSubjectDN.toString === "CN=meeh@mail.i2p, OU=I2P, O=I2P Anonymous Network, L=XX, ST=XX, C=XX")
22    }
23
24    it("should be able to tell if it's revoked or not") {
25      val cert: X509Certificate = CertUtil.loadCert(certFile)
26      assert(CertUtil.isRevoked(cert) === false)
27    }
28
29  }
30}
Note: See TracBrowser for help on using the repository browser.