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

项目:rtcdcjava    文件:DTLSTransportFactory.java   
static DTLSTransport createServerTransport(final RTCCertificate rtcCertificate,
                                           final DatagramTransport transport) throws IOException {

    final DefaultTlsServer defaultTlsServer = new DefaultTlsServer() {

        private final AsymmetricKeyParameter privateKeyAsymKeyParam = PrivateKeyFactory.createKey(rtcCertificate.getKeyPair()
                                                                                                                .getPrivate()
                                                                                                                .getEncoded());
        private final Certificate cCert = new Certificate(new org.bouncycastle.asn1.x509.Certificate[]{rtcCertificate.getCertificate().toASN1Structure()});

        @Override
        protected ProtocolVersion getMaximumVersion() {
            return ProtocolVersion.DTLSv10;
        }

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

        @Override
        protected TlsSignerCredentials getRSASignerCredentials() throws IOException {
            return new DefaultTlsSignerCredentials(this.context,
                                                   this.cCert,
                                                   this.privateKeyAsymKeyParam);
        }
    };

    return new DTLSServerProtocol(SECURE_RANDOM).accept(defaultTlsServer,
                                                        transport);
}
项目:irma_future_id    文件:TlsTestUtils.java   
static TlsSignerCredentials loadSignerCredentials(TlsContext context, String[] certResources,
                                                  String keyResource)
    throws IOException
{

    Certificate certificate = loadCertificateChain(certResources);
    AsymmetricKeyParameter privateKey = loadPrivateKeyResource(keyResource);

    return new DefaultTlsSignerCredentials(context, certificate, privateKey);
}
项目:bc-java    文件:TlsTestUtils.java   
static TlsSignerCredentials loadSignerCredentials(TlsContext context, String[] certResources,
                                                  String keyResource)
    throws IOException
{

    Certificate certificate = loadCertificateChain(certResources);
    AsymmetricKeyParameter privateKey = loadPrivateKeyResource(keyResource);

    return new DefaultTlsSignerCredentials(context, certificate, privateKey);
}
项目:irma_future_id    文件:MockDTLSServer.java   
protected TlsSignerCredentials getRSASignerCredentials()
    throws IOException
{
    return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem", "x509-ca.pem"},
        "x509-server-key.pem");
}
项目:irma_future_id    文件:TlsProtocolTest.java   
protected TlsSignerCredentials getRSASignerCredentials()
    throws IOException
{
    return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem", "x509-ca.pem"},
        "x509-server-key.pem");
}
项目:bc-java    文件:MockDTLSServer.java   
protected TlsSignerCredentials getRSASignerCredentials()
    throws IOException
{
    return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem", "x509-ca.pem"},
        "x509-server-key.pem");
}
项目:bc-java    文件:TlsProtocolTest.java   
protected TlsSignerCredentials getRSASignerCredentials()
    throws IOException
{
    return TlsTestUtils.loadSignerCredentials(context, new String[]{"x509-server.pem", "x509-ca.pem"},
        "x509-server-key.pem");
}