Java 类org.bouncycastle.crypto.tls.TlsAuthentication 实例源码

项目:irma_future_id    文件:TlsClientTest.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return new ServerOnlyTlsAuthentication()
    {
        public void notifyServerCertificate(org.bouncycastle.crypto.tls.Certificate serverCertificate)
            throws IOException
        {
            Certificate[] chain = serverCertificate.getCertificateList();
            System.out.println("Received server certificate chain with " + chain.length + " entries");
            for (int i = 0; i != chain.length; i++)
            {
                Certificate entry = chain[i];
                System.out.println("    " + entry.getSubject());
            }
        }
    };
}
项目:bc-java    文件:TlsClientTest.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return new ServerOnlyTlsAuthentication()
    {
        public void notifyServerCertificate(org.bouncycastle.crypto.tls.Certificate serverCertificate)
            throws IOException
        {
            Certificate[] chain = serverCertificate.getCertificateList();
            System.out.println("Received server certificate chain with " + chain.length + " entries");
            for (int i = 0; i != chain.length; i++)
            {
                Certificate entry = chain[i];
                System.out.println("    " + entry.getSubject());
            }
        }
    };
}
项目:rtcdcjava    文件:DTLSTransportFactory.java   
static DTLSTransport createClientTransport(final DatagramTransport transport) throws IOException {

        final DefaultTlsClient defaultTlsClient = new DefaultTlsClient() {

            @Override
            public ProtocolVersion getClientVersion() {
                return ProtocolVersion.DTLSv10;
            }

            @Override
            public ProtocolVersion getMinimumVersion() {
                return ProtocolVersion.DTLSv10;
            }

            @Override
            public TlsAuthentication getAuthentication() throws IOException {

                return new ServerOnlyTlsAuthentication() {
                    @Override
                    public void notifyServerCertificate(final Certificate serverCertificate) throws IOException {
                        //TODO Check if certificate is signed by a trusted party.
                    }
                };
            }
        };

        return new DTLSClientProtocol(SECURE_RANDOM).connect(defaultTlsClient,
                                                             transport);
    }
项目:irma_future_id    文件:MockDTLSClient.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return new TlsAuthentication()
    {
        public void notifyServerCertificate(org.bouncycastle.crypto.tls.Certificate serverCertificate)
            throws IOException
        {
            Certificate[] chain = serverCertificate.getCertificateList();
            System.out.println("Received server certificate chain of length " + chain.length);
            for (int i = 0; i != chain.length; i++)
            {
                Certificate entry = chain[i];
                // TODO Create fingerprint based on certificate signature algorithm digest
                System.out.println("    fingerprint:SHA-256 " + TlsTestUtils.fingerprint(entry) + " ("
                    + entry.getSubject() + ")");
            }
        }

        public TlsCredentials getClientCredentials(CertificateRequest certificateRequest)
            throws IOException
        {
            short[] certificateTypes = certificateRequest.getCertificateTypes();
            if (certificateTypes != null)
            {
                for (int i = 0; i < certificateTypes.length; ++i)
                {
                    if (certificateTypes[i] == ClientCertificateType.rsa_sign)
                    {
                        // TODO Create a distinct client certificate for use here
                        return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem",
                            "x509-ca.pem"}, "x509-server-key.pem");
                    }
                }
            }
            return null;
        }
    };
}
项目:irma_future_id    文件:TlsProtocolTest.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return new TlsAuthentication()
    {
        public void notifyServerCertificate(org.bouncycastle.crypto.tls.Certificate serverCertificate)
            throws IOException
        {
            Certificate[] chain = serverCertificate.getCertificateList();
            System.out.println("Received server certificate chain of length " + chain.length);
            for (int i = 0; i != chain.length; i++)
            {
                Certificate entry = chain[i];
                // TODO Create fingerprint based on certificate signature algorithm digest
                System.out.println("    fingerprint:SHA-256 " + TlsTestUtils.fingerprint(entry) + " ("
                    + entry.getSubject() + ")");
            }
        }

        public TlsCredentials getClientCredentials(CertificateRequest certificateRequest)
            throws IOException
        {
            short[] certificateTypes = certificateRequest.getCertificateTypes();
            if (certificateTypes != null)
            {
                for (int i = 0; i < certificateTypes.length; ++i)
                {
                    if (certificateTypes[i] == ClientCertificateType.rsa_sign)
                    {
                        // TODO Create a distinct client certificate for use here
                        return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem",
                            "x509-ca.pem"}, "x509-server-key.pem");
                    }
                }
            }
            return null;
        }
    };
}
项目:bc-java    文件:MockDTLSClient.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return new TlsAuthentication()
    {
        public void notifyServerCertificate(org.bouncycastle.crypto.tls.Certificate serverCertificate)
            throws IOException
        {
            Certificate[] chain = serverCertificate.getCertificateList();
            System.out.println("Received server certificate chain of length " + chain.length);
            for (int i = 0; i != chain.length; i++)
            {
                Certificate entry = chain[i];
                // TODO Create fingerprint based on certificate signature algorithm digest
                System.out.println("    fingerprint:SHA-256 " + TlsTestUtils.fingerprint(entry) + " ("
                    + entry.getSubject() + ")");
            }
        }

        public TlsCredentials getClientCredentials(CertificateRequest certificateRequest)
            throws IOException
        {
            short[] certificateTypes = certificateRequest.getCertificateTypes();
            if (certificateTypes != null)
            {
                for (int i = 0; i < certificateTypes.length; ++i)
                {
                    if (certificateTypes[i] == ClientCertificateType.rsa_sign)
                    {
                        // TODO Create a distinct client certificate for use here
                        return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem",
                            "x509-ca.pem"}, "x509-server-key.pem");
                    }
                }
            }
            return null;
        }
    };
}
项目:bc-java    文件:TlsProtocolTest.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return new TlsAuthentication()
    {
        public void notifyServerCertificate(org.bouncycastle.crypto.tls.Certificate serverCertificate)
            throws IOException
        {
            Certificate[] chain = serverCertificate.getCertificateList();
            System.out.println("Received server certificate chain of length " + chain.length);
            for (int i = 0; i != chain.length; i++)
            {
                Certificate entry = chain[i];
                // TODO Create fingerprint based on certificate signature algorithm digest
                System.out.println("    fingerprint:SHA-256 " + TlsTestUtils.fingerprint(entry) + " ("
                    + entry.getSubject() + ")");
            }
        }

        public TlsCredentials getClientCredentials(CertificateRequest certificateRequest)
            throws IOException
        {
            short[] certificateTypes = certificateRequest.getCertificateTypes();
            if (certificateTypes != null)
            {
                for (int i = 0; i < certificateTypes.length; ++i)
                {
                    if (certificateTypes[i] == ClientCertificateType.rsa_sign)
                    {
                        // TODO Create a distinct client certificate for use here
                        return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem",
                            "x509-ca.pem"}, "x509-server-key.pem");
                    }
                }
            }
            return null;
        }
    };
}
项目:irma_future_id    文件:BasicTlsTest.java   
MyTlsClient(TlsAuthentication authentication)
{
    this.authentication = authentication;
}
项目:irma_future_id    文件:BasicTlsTest.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return authentication;
}
项目:irma_future_id    文件:TestTlsClient.java   
TestTlsClient(TlsAuthentication authentication)
{
    this.authentication = authentication;
}
项目:irma_future_id    文件:TestTlsClient.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return authentication;
}
项目:bc-java    文件:BasicTlsTest.java   
MyTlsClient(TlsAuthentication authentication)
{
    this.authentication = authentication;
}
项目:bc-java    文件:BasicTlsTest.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return authentication;
}
项目:bc-java    文件:TestTlsClient.java   
TestTlsClient(TlsAuthentication authentication)
{
    this.authentication = authentication;
}
项目:bc-java    文件:TestTlsClient.java   
public TlsAuthentication getAuthentication()
    throws IOException
{
    return authentication;
}