Best code examples for Java 8 X509CertSelector class (java.security.cert.X509CertSelector)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 X509CertSelector class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 X509CertSelector examples from Open Source projects
This code example shows how to use the following methods: setIssuer, setSerialNumber, setSubjectKeyIdentifier
    { 
    } 
 
    protected X509CertSelector doConversion(X500Name issuer, BigInteger serialNumber, byte[] subjectKeyIdentifier)
    { 
        X509CertSelector selector = new X509CertSelector();
 
        if (issuer != null)
        { 
            try 
            { 
                selector.setIssuer(issuer.getEncoded());
            } 
            catch (IOException e)
            { 
                throw new IllegalArgumentException("unable to convert issuer: " + e.getMessage());
            } 
        } 
 
        if (serialNumber != null)

7
CodeRank
This code example shows how to use the following methods: getIssuerAsBytes, getSerialNumber, getSubjectKeyIdentifier
 
    public X509CertificateHolderSelector getCertificateHolderSelector(X509CertSelector certSelector)
    { 
try 
{ 
        if (certSelector.getSubjectKeyIdentifier() != null)
        { 
            return new X509CertificateHolderSelector(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber(), ASN1OctetString.getInstance(certSelector.getSubjectKeyIdentifier()).getOctets());
        } 
        else 
        { 
            return new X509CertificateHolderSelector(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber());
        } 
} 
catch (Exception e)
{ 
throw new IllegalArgumentException("conversion failed: " + e.toString());
} 
    } 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setCertificate, setSubject
This code example shows how to use the following methods: getIssuerAsBytes, getSerialNumber, getSubjectKeyIdentifier
 
    public SignerId getSignerId(X509CertSelector certSelector)
    { 
        try 
        { 
            if (certSelector.getSubjectKeyIdentifier() != null)
            { 
                return new SignerId(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber(), ASN1OctetString.getInstance(certSelector.getSubjectKeyIdentifier()).getOctets());
            } 
            else 
            { 
                return new SignerId(X500Name.getInstance(certSelector.getIssuerAsBytes()), certSelector.getSerialNumber());
            } 
        } 
        catch (IOException e)
        { 
            throw new IllegalArgumentException("unable to convert issuer: " + e.getMessage());
        } 
    } 
 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSubject
        X509CertSelector selector = new X509CertSelector();
        // with BC as provider for the factory, this fails if i do getSubjectDN().toString() 
        selector.setSubject(cert.getSubjectX500Principal());
        assertEquals(1, store.engineGetCertificates(selector).size());
 
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setSubject("CN=non-existent");
        assertEquals(0, store.engineGetCertificates(certSelector).size());
         
    } 
 
} 
Full Snippet Info
6
CodeRank