Java 8 X509CertSelector - 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 X509CertSelector class.

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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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)

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setNameConstraints
import java.security.cert.X509CertSelector; 
 
public class SetNameConstraintsEmptySequence { 
 
    public static void main(String[] args) throws Exception {
         X509CertSelector certSel = new X509CertSelector();
         byte[] data = {0x30, 0x00};        // An empty SEQUENCE
         certSel.setNameConstraints(data);
    } 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setSubject
This code example shows how to use the following methods: setCertificate
    private TrustedCertPathFinder() { 
        //this should not be instantiated. 
    } 
 
    private static CertPath isTrustedCert(KeyStore keyStore, X509Certificate x509Certificate, List<X509Certificate> trustedCertPath) throws CertPathValidatorException {
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(x509Certificate);
        Collection<? extends Certificate> caCerts;
        try { 
            caCerts = KeyStoreUtil.getTrustedCertificates(keyStore, certSelector);
        } catch (KeyStoreException e) {
            throw new CertPathValidatorException(
                    "Error accessing trusted certificate store", e);
        } 
        if ((caCerts.size() > 0)&&(x509Certificate.getBasicConstraints() != -1)) {
 
            trustedCertPath.add(x509Certificate);
            // JGLOBUS-92 
            try { 
                CertificateFactory certFac = CertificateFactory.getInstance("X.509");
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setBasicConstraints
See Code Examples for Java 8 X509CertSelector Methods: