io.netty.handler.ssl.OpenSsl.selfSignedCertificate()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(254)

本文整理了Java中io.netty.handler.ssl.OpenSsl.selfSignedCertificate()方法的一些代码示例,展示了OpenSsl.selfSignedCertificate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OpenSsl.selfSignedCertificate()方法的具体详情如下:
包路径:io.netty.handler.ssl.OpenSsl
类名称:OpenSsl
方法名:selfSignedCertificate

OpenSsl.selfSignedCertificate介绍

[英]Returns a self-signed X509Certificate for netty.io.
[中]返回netty的自签名X509证书。伊奥。

代码示例

代码示例来源:origin: redisson/redisson

static X509ExtendedTrustManager wrap(X509ExtendedTrustManager tm, boolean client) {
  if (PlatformDependent.javaVersion() < 11) {
    try {
      X509Certificate[] certs = { OpenSsl.selfSignedCertificate() };
      if (client) {
        tm.checkServerTrusted(certs, "RSA", new DummySSLEngine(true));
      } else {
        tm.checkClientTrusted(certs, "RSA", new DummySSLEngine(false));
      }
    } catch (IllegalArgumentException e) {
      // If this happened we failed because our protocol version was not known by the implementation.
      // See http://mail.openjdk.java.net/pipermail/security-dev/2018-September/018242.html.
      return new OpenSslTlsv13X509ExtendedTrustManager(tm);
    } catch (Throwable ignore) {
      // Just assume we do not need to wrap.
    }
  }
  return tm;
}

代码示例来源:origin: io.netty/netty-handler

static X509ExtendedTrustManager wrap(X509ExtendedTrustManager tm, boolean client) {
  if (PlatformDependent.javaVersion() < 11) {
    try {
      X509Certificate[] certs = { OpenSsl.selfSignedCertificate() };
      if (client) {
        tm.checkServerTrusted(certs, "RSA", new DummySSLEngine(true));
      } else {
        tm.checkClientTrusted(certs, "RSA", new DummySSLEngine(false));
      }
    } catch (IllegalArgumentException e) {
      // If this happened we failed because our protocol version was not known by the implementation.
      // See http://mail.openjdk.java.net/pipermail/security-dev/2018-September/018242.html.
      return new OpenSslTlsv13X509ExtendedTrustManager(tm);
    } catch (Throwable ignore) {
      // Just assume we do not need to wrap.
    }
  }
  return tm;
}

相关文章