本文整理汇总了Java中org.bouncycastle.crypto.tls.DefaultTlsSignerCredentials类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTlsSignerCredentials类的具体用法?Java DefaultTlsSignerCredentials怎么用?Java DefaultTlsSignerCredentials使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTlsSignerCredentials类属于org.bouncycastle.crypto.tls包,在下文中一共展示了DefaultTlsSignerCredentials类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createServerTransport
import org.bouncycastle.crypto.tls.DefaultTlsSignerCredentials; //导入依赖的package包/类
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);
}
示例2: loadSignerCredentials
import org.bouncycastle.crypto.tls.DefaultTlsSignerCredentials; //导入依赖的package包/类
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);
}