Java 8 X509CRLSelector - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 X509CRLSelector class.

This code example shows how to use the following methods:addIssuer, setDateAndTime, setMaxCRLNumber, setMinCRLNumber, toString
        assertFalse("The changes of the clone selector should not cause "
                + "the changes of initial object", selector.getIssuerNames()
                .size() == 3);
    } 
    public void testToString() { 
        X509CRLSelector selector = new X509CRLSelector();
        X500Principal iss1 = new X500Principal("O=First Org.");
        X500Principal iss2 = new X500Principal("O=Second 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);
 
        assertNotNull("The result should not be null.", selector.toString());
    } 

8
CodeRank
This code example shows how to use the following methods:getCertificateChecking, getDateAndTime, getIssuerNames, getIssuers, getMaxCRL
        { 
            throw new IllegalArgumentException(
                "cannot create from null selector"); 
        } 
        X509CRLStoreSelector cs = new X509CRLStoreSelector();
        cs.setCertificateChecking(selector.getCertificateChecking());
        cs.setDateAndTime(selector.getDateAndTime());
        try 
        { 
            cs.setIssuerNames(selector.getIssuerNames());
        } 
        catch (IOException e)
        { 
            // cannot happen 
            throw new IllegalArgumentException(e.getMessage());
        } 
        cs.setIssuers(selector.getIssuers());
        cs.setMaxCRLNumber(selector.getMaxCRL());
        cs.setMinCRLNumber(selector.getMinCRL());
        return cs;

7
CodeRank
This code example shows how to use the following methods:getCertificateChecking, getDateAndTime, getIssuerNames, getIssuers, getMaxCRL
        { 
            throw new IllegalArgumentException(
                "cannot create from null selector"); 
        } 
        X509CRLStoreSelector cs = new X509CRLStoreSelector();
        cs.setCertificateChecking(selector.getCertificateChecking());
        cs.setDateAndTime(selector.getDateAndTime());
        try 
        { 
            cs.setIssuerNames(selector.getIssuerNames());
        } 
        catch (IOException e)
        { 
            // cannot happen 
            throw new IllegalArgumentException(e.getMessage());
        } 
        cs.setIssuers(selector.getIssuers());
        cs.setMaxCRLNumber(selector.getMaxCRL());
        cs.setMinCRLNumber(selector.getMinCRL());
        return cs;

7
CodeRank
This code example shows how to use the following methods:getCertificateChecking, getDateAndTime, getIssuerNames, getIssuers, getMaxCRL
        { 
            throw new IllegalArgumentException(
                "cannot create from null selector"); 
        } 
        X509CRLStoreSelector cs = new X509CRLStoreSelector();
        cs.setCertificateChecking(selector.getCertificateChecking());
        cs.setDateAndTime(selector.getDateAndTime());
        try 
        { 
            cs.setIssuerNames(selector.getIssuerNames());
        } 
        catch (IOException e)
        { 
            // cannot happen 
            throw new IllegalArgumentException(e.getMessage());
        } 
        cs.setIssuers(selector.getIssuers());
        cs.setMaxCRLNumber(selector.getMaxCRL());
        cs.setMinCRLNumber(selector.getMinCRL());
        return cs;

6
CodeRank
This code example shows how to use the following methods:getCertificateChecking, getDateAndTime, getIssuerNames, getIssuers, getMaxCRL
        { 
            throw new IllegalArgumentException(
                "cannot create from null selector"); 
        } 
        X509CRLStoreSelector cs = new X509CRLStoreSelector();
        cs.setCertificateChecking(selector.getCertificateChecking());
        cs.setDateAndTime(selector.getDateAndTime());
        try 
        { 
            cs.setIssuerNames(selector.getIssuerNames());
        } 
        catch (IOException e)
        { 
            // cannot happen 
            throw new IllegalArgumentException(e.getMessage());
        } 
        cs.setIssuers(selector.getIssuers());
        cs.setMaxCRLNumber(selector.getMaxCRL());
        cs.setMinCRLNumber(selector.getMinCRL());
        return cs;

6
CodeRank
This code example shows how to use the following methods:addIssuerName
 
        params = new SimpleMemoryCertStoreParams(new X509Certificate[] {cert}, new X509CRL[] {crl});
        store = new SimpleMemoryCertStore(params);
        assertEquals(1, store.engineGetCRLs(new X509CRLSelector()).size());
 
        X509CRLSelector crlSelector = new X509CRLSelector();
        crlSelector.addIssuerName("CN=non-existent");
        assertEquals(0, store.engineGetCRLs(crlSelector).size());
    } 
 
    @Test 
    public void testEngineGetCertificatesCertSelector() throws Exception { 
        SimpleMemoryCertStoreParams params = new SimpleMemoryCertStoreParams(null, null);
        store = new SimpleMemoryCertStore(params);
        assertEquals(0, store.engineGetCertificates(new X509CertSelector()).size());
 
        params = new SimpleMemoryCertStoreParams(new X509Certificate[] {cert}, new X509CRL[] {crl});
        store = new SimpleMemoryCertStore(params);
        assertEquals(1, store.engineGetCertificates(new X509CertSelector()).size());
 
6
CodeRank
This code example shows how to use the following methods:addIssuer, getIssuers
    private static final String PRINCIPAL_STRING =
            "C=US, ST=California, L=Mountain View, O=Google Inc, CN=www.google.com"; 
    private static final X500Principal PRINCIPAL = new X500Principal(PRINCIPAL_STRING);
 
    public void testGetIssuersImmutable() { 
        X509CRLSelector crlSelector = new X509CRLSelector();
        crlSelector.addIssuer(PRINCIPAL);
        Collection<X500Principal> issuers = crlSelector.getIssuers();
        try { 
            issuers.clear();
            fail();
        } catch (UnsupportedOperationException expected) {
        } 
    } 
 
    public void testGetIssuersNamesCopy() { 
        X509CRLSelector crlSelector = new X509CRLSelector();
        crlSelector.addIssuer(PRINCIPAL);
        Collection<Object> issuers = crlSelector.getIssuerNames();
        assertEquals(1, issuers.size());
6
CodeRank
This code example shows how to use the following methods:addIssuerName
 
        params = new SimpleMemoryCertStoreParams(new X509Certificate[] {cert}, new X509CRL[] {crl});
        store = new SimpleMemoryCertStore(params);
        assertEquals(1, store.engineGetCRLs(new X509CRLSelector()).size());
 
        X509CRLSelector crlSelector = new X509CRLSelector();
        crlSelector.addIssuerName("CN=non-existent");
        assertEquals(0, store.engineGetCRLs(crlSelector).size());
    } 
 
    @Test
    public void testEngineGetCertificatesCertSelector() throws Exception {
        SimpleMemoryCertStoreParams params = new SimpleMemoryCertStoreParams(null, null);
        store = new SimpleMemoryCertStore(params);
        assertEquals(0, store.engineGetCertificates(new X509CertSelector()).size());
 
        params = new SimpleMemoryCertStoreParams(new X509Certificate[] {cert}, new X509CRL[] {crl});
        store = new SimpleMemoryCertStore(params);
        assertEquals(1, store.engineGetCertificates(new X509CertSelector()).size());
 
5
CodeRank
This code example shows how to use the following methods:addIssuer, getIssuers
    private static final String PRINCIPAL_STRING =
            "C=US, ST=California, L=Mountain View, O=Google Inc, CN=www.google.com"; 
    private static final X500Principal PRINCIPAL = new X500Principal(PRINCIPAL_STRING);
 
    public void testGetIssuersImmutable() { 
        X509CRLSelector crlSelector = new X509CRLSelector();
        crlSelector.addIssuer(PRINCIPAL);
        Collection<X500Principal> issuers = crlSelector.getIssuers();
        try { 
            issuers.clear();
            fail();
        } catch (UnsupportedOperationException expected) {
        } 
    } 
 
    public void testGetIssuersNamesCopy() { 
        X509CRLSelector crlSelector = new X509CRLSelector();
        crlSelector.addIssuer(PRINCIPAL);
        Collection<Object> issuers = crlSelector.getIssuerNames();
        assertEquals(1, issuers.size());
5
CodeRank
This code example shows how to use the following methods:getCertificateChecking, getDateAndTime, getIssuerNames, getIssuers, getMaxCRL
		if (selector == null) {
			throw new IllegalArgumentException(
					"cannot create from null selector"); 
		} 
		X509CRLStoreSelector cs = new X509CRLStoreSelector();
		cs.setCertificateChecking(selector.getCertificateChecking());
		cs.setDateAndTime(selector.getDateAndTime());
		try { 
			cs.setIssuerNames(selector.getIssuerNames());
		} catch (IOException e) {
			// cannot happen 
			throw new IllegalArgumentException(e.getMessage());
		} 
		cs.setIssuers(selector.getIssuers());
		cs.setMaxCRLNumber(selector.getMaxCRL());
		cs.setMinCRLNumber(selector.getMinCRL());
		return cs;
	} 
 
	public Object clone() { 
		X509CRLStoreSelector sel = X509CRLStoreSelector.getInstance(this);
5
CodeRank
See Code Examples for Java 8 X509CRLSelector Methods: