use of java.security.cert.X509CRL in project robovm by robovm.
the class X509CRLTest method getSignature.
private void getSignature(CertificateFactory f) throws Exception {
X509CRL crlRsa = getCRL(f, CRL_RSA);
byte[] expected = getResourceAsBytes(CRL_RSA_SIG);
assertEquals(Arrays.toString(expected), Arrays.toString(crlRsa.getSignature()));
}
use of java.security.cert.X509CRL in project robovm by robovm.
the class X509CRLTest method getRevokedCertificates.
private void getRevokedCertificates(CertificateFactory f) throws Exception {
X509CRL crlEmpty = getCRL(f, CRL_EMPTY);
assertNull(crlEmpty.getRevokedCertificates());
X509CRL crlRsa = getCRL(f, CRL_RSA);
X509Certificate rsaCert = getCertificate(f, CERT_RSA);
X509Certificate dsaCert = getCertificate(f, CERT_DSA);
Set<? extends X509CRLEntry> entries = crlRsa.getRevokedCertificates();
assertEquals(1, entries.size());
for (X509CRLEntry e : entries) {
assertRsaCrlEntry(f, e);
}
X509CRL crlRsaDsa = getCRL(f, CRL_RSA_DSA);
Set<? extends X509CRLEntry> entries2 = crlRsaDsa.getRevokedCertificates();
assertEquals(2, entries2.size());
assertRsaCrlEntry(f, crlRsaDsa.getRevokedCertificate(rsaCert));
assertDsaCrlEntry(f, crlRsaDsa.getRevokedCertificate(dsaCert));
}
use of java.security.cert.X509CRL in project robovm by robovm.
the class X509CRLTest method test_toString.
private void test_toString(CertificateFactory f) throws Exception {
X509CRL crl1 = getCRL(f, CRL_RSA);
X509CRL crl2 = getCRL(f, CRL_RSA);
X509CRL crlRsaDsa = getCRL(f, CRL_RSA_DSA);
assertNotNull(crl1);
assertNotNull(crlRsaDsa);
assertEquals(crl1.toString(), crl2.toString());
assertFalse(crl1.toString().equals(crlRsaDsa.toString()));
}
use of java.security.cert.X509CRL in project robovm by robovm.
the class X509CRLTest method getSigAlgName.
private void getSigAlgName(CertificateFactory f) throws Exception {
X509CRL crlRsa = getCRL(f, CRL_RSA);
String actual = crlRsa.getSigAlgName().toUpperCase(Locale.US);
// Bouncycastle is broken
if ("BC".equals(f.getProvider().getName())) {
assertEquals("1.2.840.113549.1.1.5", actual);
} else {
assertEquals("SHA1WITHRSA", actual);
}
}
use of java.security.cert.X509CRL in project robovm by robovm.
the class X509CRLTest method verify.
private void verify(CertificateFactory f) throws Exception {
X509CRL crlRsa = getCRL(f, CRL_RSA);
X509Certificate caCert = getCertificate(f, CERT_CRL_CA);
crlRsa.verify(caCert.getPublicKey());
X509Certificate dsaCert = getCertificate(f, CERT_DSA);
try {
crlRsa.verify(dsaCert.getPublicKey());
fail("should not verify using incorrect key type");
} catch (InvalidKeyException expected) {
}
}
Aggregations