use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testAddIssuerName$B.
/**
* addIssuerName(byte[] name) method testing. Tests if CRLs with specified
* issuers match the selector, and if not specified issuer does not match
* the selector.
*/
public void testAddIssuerName$B() {
X509CRLSelector selector = new X509CRLSelector();
byte[] iss1 = new byte[] // manually obtained DER encoding of "O=First Org." issuer name;
{ 48, 21, 49, 19, 48, 17, 6, 3, 85, 4, 10, 19, 10, 70, 105, 114, 115, 116, 32, 79, 114, 103, 46 };
byte[] iss2 = new byte[] // manually obtained DER encoding of "O=Second Org." issuer name;
{ 48, 22, 49, 20, 48, 18, 6, 3, 85, 4, 10, 19, 11, 83, 101, 99, 111, 110, 100, 32, 79, 114, 103, 46 };
TestCRL crl1 = new TestCRL(new X500Principal(iss1));
TestCRL crl2 = new TestCRL(new X500Principal(iss2));
try {
selector.addIssuerName(iss1);
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
assertTrue("The CRL should match the selection criteria.", selector.match(crl1));
assertFalse("The CRL should not match the selection criteria.", selector.match(crl2));
try {
selector.addIssuerName(iss2);
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
assertTrue("The CRL should match the selection criteria.", selector.match(crl2));
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testClone.
/**
* clone() method testing. Tests if the selector is cloned correctly: the
* crl which matche to the initial selector should match to the clone and
* the change of clone should not cause the change of initial selector.
*/
@AndroidOnly("Uses specific classes: " + "org.apache.harmony.security.asn1.ASN1OctetString, " + "org.apache.harmony.security.asn1.ASN1Integer.")
public void testClone() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
X500Principal iss3 = new X500Principal("O=Third Org.");
BigInteger minCRL = new BigInteger("10000");
BigInteger maxCRL = new BigInteger("10000");
Date date = new Date(200);
selector.addIssuer(iss1);
selector.addIssuer(iss2);
selector.setMinCRLNumber(minCRL);
selector.setMaxCRLNumber(maxCRL);
selector.setDateAndTime(date);
X509CRLSelector clone = (X509CRLSelector) selector.clone();
TestCRL crl = new TestCRL(iss1);
crl.setCrlNumber(minCRL);
crl.setUpdateDates(new Date(200), new Date(200));
assertTrue("The specified CRL should match the clone selector.", selector.match(crl));
clone.addIssuer(iss3);
assertFalse("The changes of the clone selector should not cause " + "the changes of initial object", selector.getIssuerNames().size() == 3);
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelectorTest method test_addIssuerNameLjava_lang_String02.
/**
* java.security.cert.X509CRLSelector#addIssuerName(java.lang.String)
*/
public void test_addIssuerNameLjava_lang_String02() throws IOException {
// Regression for HARMONY-736
X509CRLSelector selector = new X509CRLSelector();
// no exception for null
selector.addIssuerName((String) null);
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelectorTest method test_setIssuerNamesLjava_util_Collection01.
/**
* setIssuerNames(Collection <?> names)
*/
public void test_setIssuerNamesLjava_util_Collection01() throws IOException {
// Regression for HARMONY-737
X509CRLSelector selector = new X509CRLSelector();
selector.setIssuerNames(new TreeSet<Comparable>() {
private static final long serialVersionUID = 6009545505321092498L;
public Iterator<Comparable> iterator() {
return null;
}
});
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelectorTest method testGetIssuersImmutable.
public void testGetIssuersImmutable() {
X509CRLSelector crlSelector = new X509CRLSelector();
crlSelector.addIssuer(PRINCIPAL);
Collection<X500Principal> issuers = crlSelector.getIssuers();
try {
issuers.clear();
fail();
} catch (UnsupportedOperationException expected) {
}
}
Aggregations