- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用证书及其私钥启动安全 RSocket,但我不明白为什么它会在 secure{...}
语句中抛出异常: java.lang.IllegalArgumentException:既未指定 SslContextBuilder 也未指定 SslContext
RSocketFactory.receive()
.frameDecoder(PayloadDecoder.DEFAULT)
.acceptor { setup, sendingSocket ->
Mono.just(
object : AbstractRSocket() {
override fun requestStream(payload: Payload): Flux<Payload> {
val randomNumberGenerator = Random(1234)
val numbers = payload.dataUtf8.toInt()
println("Generating $numbers random numbers")
return IntRange(1, numbers)
.map { DefaultPayload.create(randomNumberGenerator.nextUInt().toString().toByteArray()) }
.toList().toFlux()
}
})
}
.transport(
TcpServerTransport.create(TcpServer.create().port(7878).secure {
SslContextBuilder.forServer(
File(RequestStreamRSocket::class.java.getResource("certificate.pem").toURI()),
File(RequestStreamRSocket::class.java.getResource("key.pem").toURI())
)
})
)
.start()
.block()
?.onClose()
完整日志:
/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60628,suspend=y,server=n -javaagent:/Users/jose/Library/Caches/IntelliJIdea2019.2/groovyHotSwap/gragent.jar -javaagent:/Users/jose/Library/Caches/IntelliJIdea2019.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/tools.jar:/Users/jose/git/codependent/github/rsocket-simple-client/build/classes/java/main:/Users/jose/git/codependent/github/rsocket-simple-client/out/production/resources:/Users/jose/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.3.50/bf65725d4ae2cf00010d84e945fcbc201f590e11/kotlin-stdlib-jdk8-1.3.50.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.rsocket/rsocket-transport-netty/1.0.0-RC5/7d0093068e332fcbfa3e9f5de971174a795a9122/rsocket-transport-netty-1.0.0-RC5.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.rsocket/rsocket-core/1.0.0-RC5/fbe165e1e57c5748a40af66832206c4616aa6290/rsocket-core-1.0.0-RC5.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.50/50ad05ea1c2595fb31b800e76db464d08d599af3/kotlin-stdlib-jdk7-1.3.50.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.50/b529d1738c7e98bbfa36a4134039528f2ce78ebf/kotlin-stdlib-1.3.50.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.projectreactor.netty/reactor-netty/0.9.0.RELEASE/f0a0ae4e38ad8b36596ffe4bf82519cf8fc4adfb/reactor-netty-0.9.0.RELEASE.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http2/4.1.39.Final/6e4660fb8b1054e34e09aa95a10115edf0d74f37/netty-codec-http2-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler-proxy/4.1.39.Final/8a5c8a0b4ceb75531d04a14e0e65839ee07f2378/netty-handler-proxy-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.39.Final/732d06961162e27fa3ae5989541c4460853745d3/netty-codec-http-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.39.Final/4a63b56de071c1b10a56b5d90095e4201ea4098f/netty-handler-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.39.Final/ab86de9bb5fccbfb60a9c0036a3516ad9b8befbb/netty-transport-native-epoll-4.1.39.Final-linux-x86_64.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-socks/4.1.39.Final/adc3df7362874b53c11e56f79c53ebea97d29aa7/netty-codec-socks-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.39.Final/38b9d79e31f6b00bd680f88c0289a2522d30d05b/netty-codec-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-unix-common/4.1.39.Final/e5d94d2f6847919afbbfdb08a7a9e1f9ae19b101/netty-transport-native-unix-common-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.39.Final/25374210da8a561689c4280e9d5661ff5dee30b7/netty-transport-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.39.Final/3518c7c7d0097460eeeaba32fb0c241b9cbe628a/netty-buffer-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.projectreactor/reactor-core/3.3.0.RELEASE/4824f980e5696e95289d5fb0de62e3d34508b358/reactor-core-3.3.0.RELEASE.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.25/da76ca59f6a57ee3102f8f9bd9cee742973efa8a/slf4j-api-1.7.25.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.50/3d9cd3e1bc7b92e95f43d45be3bfbcf38e36ab87/kotlin-stdlib-common-1.3.50.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.39.Final/2ca0a547341ba72dacf60121302357e7ea110b96/netty-resolver-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.39.Final/9c8c6d0dd43ee26ec8052a42d3ee1113dc6c08ed/netty-common-4.1.39.Final.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/org.reactivestreams/reactive-streams/1.0.3/d9fb7a7926ffa635b3dcaa5049fb2bfa25b3e7d0/reactive-streams-1.0.3.jar:/Users/jose/.gradle/caches/modules-2/files-2.1/io.projectreactor.addons/reactor-pool/0.1.0.RELEASE/3aa0e33a1647a85e94bea47d7efb57c46977c71a/reactor-pool-0.1.0.RELEASE.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar" RequestStreamRSocketKt
Connected to the target VM, address: '127.0.0.1:60628', transport: 'socket'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.IllegalArgumentException: Neither SslContextBuilder nor SslContext is specified
at reactor.netty.tcp.SslProvider.<init>(SslProvider.java:313)
at reactor.netty.tcp.SslProvider$Build.build(SslProvider.java:551)
at reactor.netty.tcp.TcpServerSecure.secure(TcpServerSecure.java:36)
at reactor.netty.tcp.TcpServer.secure(TcpServer.java:458)
at RequestStreamRSocketKt.main(RequestStreamRSocket.kt:45)
at RequestStreamRSocketKt.main(RequestStreamRSocket.kt)
Disconnected from the target VM, address: '127.0.0.1:60628', transport: 'socket'
Process finished with exit code 1
最佳答案
问题是我没有将 SslContext
设置到 SslProvider.SslContextSpec
中:
.transport(
TcpServerTransport.create(TcpServer.create().port(7878).secure {
it.sslContext(
SslContextBuilder.forServer(
File(RequestStreamRSocket::class.java.getResource("certificate.pem").toURI())
File(RequestStreamRSocket::class.java.getResource("key.pem").toURI())
)
)
})
)
关于ssl - 安全 RSocket 抛出 java.lang.IllegalArgumentException : Neither SslContextBuilder nor SslContext is specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58924632/
我正在尝试在 GWT Jetty 开发模式下执行以下代码 final SSLContext sslContext = SSLContext.getInstance(PROTOCOL);
如何将 javax.net.ssl.SSLContext 转换为 io.netty.handler.ssl.SslContext ?我可以访问 SSLContext,但需要在我的客户端库中设置 SSl
我正在开发一个应用程序,它是一个独立的应用程序,并将其打包为 jar 文件(类似于 OSGi 插件),并将该 jar 部署到 JBoss 。 当我在 Eclipse 中运行应用程序时,应用程序工作正常
我在以下远程服务器设置上使用 Python 3.6.5: Server: Windows 10 Python: 3.6.5 Requests: 2.18.4 Pentaho: 8.0 当我在服务器命令
我试图弄清楚如何使用 Request 指定 SSLContext。 我有两个功能理论上应该做同样的事情,但是带有 Requests 的那个不起作用。 def func_OK(token): c
我有以下简单的类(class): 导入 javax.net.ssl.SSLContext; public class AClass { public void someMethod() thr
我有以下简单的类(class): 导入 javax.net.ssl.SSLContext; public class AClass { public void someMethod() thr
请帮助了解如何向 SSL 上下文提供证书链。 简介:我正在使用 EWSJavaAPI 1.2 连接到 ms Exchange。它使用带有双向身份验证的 TLS 连接,基于我自己的公司颁发的证书,该证书
基于 Jcs ( HttpUnit WebConversation SSL Issues ) 的回答,我尝试用我自己的信任管理器替换 SSLContext.getDefault()。 SSLConte
我见过很多构造一个将接受所有服务器证书的 SSLContext 的例子。对于我的测试用例,我试图做完全相反的事情并强制客户端拒绝服务器的证书。 所以我正在尝试创建一个不包含根证书的 KeyStore
我正在尝试创建自己的 HTTPS 服务器,并且有两个代码片段: 第一个: private SSLContext createSSLContext() throws KeyStoreException,
在测试我的客户端-服务器分布式系统时,一开始我很惊讶地发现 TLS 的默认 JSSE 实现不进行主机名验证。我在 this 中尝试了接受的答案问题,但我的用例有点不同。我使用 RabbitMQ 的连接
我使用 OpenSSL 库在 Ruby 中编写了以下代码,该库从 cloudflare.com 获取证书链。但是 Cloudflare 有一个混合系统,旧浏览器接收 RSA 证书,新客户端接收 ECD
整个代码比较复杂,直接进入正题。代码如下 SSLContext ctx = SSLContext.getInstance("TLS"); 如果您阅读 docs对于它说的 getInstance(Str
当我尝试使用 getServerSocket 方法初始化 SSLServerSocket 时,如下所示,并定义了 keystore : public static ServerSocket getSe
我像这样使用 Java 6 (SunJSSE) 中的默认 JSSE 提供程序, SSLContext sslCtx = SSLContext.getInstance("TLS"); 我可以从多个线程安
我正在以标准方式创建 SSLContext: 获取.p12证书文件, 创建 keystore 并将证书加载到其中, 创建 KeyManagerFactory,使用 KeyStore 初始化它,并获取
如果我使用以下代码是因为我想更改证书的验证方式。 trm = 一些信任经理 SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, n
我的问题的基本组成部分是(上下文跟随代码片段) 以下代码是否是通过 -Djavax.net.ssl.keystore 设置默认 Java keystore 的有效替代方法? 除了更改默认 key 和信
我们接到电话SSLContext.getInstance("TLS")报告为漏洞。推荐的修复方法是使用 SSLContext.getInstance("TLSv1.2") . 我了解到自 2021 年
我是一名优秀的程序员,十分优秀!