我正在使用 Apache Mina(Mina2 - 无法使用 Netty - 不要问为什么 :P)创建一个通过 TLS 连接到 TCP 服务器的 TCP 客户端。
这是 SSLContext:
这是我的蓝图 xml 路由:
<route id="ReadMQ">
<from uri="jmsep://topic:test/014/data" />
<process ref="readIt"></process>
<to
uri="mina2:tcp://SOMEHOST:38332?sync=true;sslContextParameters=#mySSL;minaLogger=true" />
</route>
cert.pem 包含 key 和证书。
当 Nina 尝试连接到端点时,它的服务器关闭连接并出现以下错误:
System.IO.IOException: The handshake failed due to an unexpected packet format.
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
看error,感觉Mina没有连接正确的协议(protocol)?
米娜是这样说的:
SEVERE: Exception on receiving message from address: SOMEHOST:38332 using connector: (nio socket connector: managedSessionCount: 0)
Throwable occurred: java.io.IOException: An existing connection was forcibly closed by the remote host.
此外,当我以这种方式使用 s_client 时: openssl s_client -connect SOMEHOST:38332 -cert cert.pem -key cert.pem -state -debug
它开始执行 SSL 握手并交换证书。
有什么线索是我在这里遗漏的吗?
最佳答案
keystore 中的 key 和信任库中的证书未被添加,因为它们是 PEM 格式。服务器将请求客户端证书,而客户端的证书链将为空,因此会出现错误。 为了解决这个问题,我创建了一个 JKS 格式的 keystore 并导入了 p12 文件(使用 pem 文件创建)并且它起作用了。
关于ssl - Apache Mina TLS 客户端 - Camel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34192354/
我正在尝试在ruby脚本中连接到服务器https://www.xpiron.com/schedule。但是,当我尝试连接时:require'open-uri'doc=open('https://www.xpiron.com/schedule')我收到以下错误消息:OpenSSL::SSL::SSLError:SSL_connectreturned=1errno=0state=SSLv2/v3readserverhelloA:sslv3alertunexpectedmessagefrom/usr/local/lib/ruby/1.9.1/net/http.rb:678:in`conn
我正在使用Rails3.2.6和Stipe进行支付。是否有可能在不购买ssl证书的情况下进行付款。我可以使用Stripe页面作为我的支付页面吗? 最佳答案 您可以使用stripe.js在技术上跳过SSL但我强烈建议您设置SSL。它所做的是将信用卡信息直接传递给stripe,然后stripe会给你一个token,用于实际进行收费。这样做意味着信用卡信息永远不会接触您的服务器,您不必担心PCI合规性。但是,您仍应设置SSL以防止中间人攻击。您可以在https://stripe.com/docs/tutorials/forms找到有关如何
我想在Ruby的TCPServer中获取客户端的IP地址。以及(如果可能的话)MAC地址。例如,Ruby中的时间服务器,请参阅评论。tcpserver=TCPServer.new("",80)iftcpserverputs"Listening"loopdosocket=tcpserver.acceptifsocketThread.newdoputs"Connectedfrom"+#HERE!HowcanigettheIPAddressfromtheclient?socket.write(Time.now.to_s)socket.closeendendendend非常感谢!
尝试通过SSL连接到ImgurAPI时出现错误。这是代码和错误:API_URI=URI.parse('https://api.imgur.com')API_PUBLIC_KEY='Client-ID--'ENDPOINTS={:image=>'/3/image',:gallery=>'/3/gallery'}#Public:Uploadanimage##args-Theimagepathfortheimagetoupload#defupload(image_path)http=Net::HTTP.new(API_URI.host)http.use_ssl=truehttp.verify
我编写了一个使用ruby线程的代码。require'rubygems'require'net/http'require'uri'defget_response()uri=URI.parse('https://..........')http=Net::HTTP.new(uri.host,uri.port)http.use_ssl=true----------endt1=[]15.timesdo|i|t1[i]=Thread.new{hit_mdm(i)sleep(rand(0)/10.0)}endt1.each{|t|t.join}代码工作正常,但是当程序执行到最后时它会抛出以下错
我正在运行本地puma服务器,但无法在SSL下加载资源。我有一个本地签名的证书。我正在尝试使用以下配置运行服务器:puma-b'ssl://127.0.0.1:9292?key=/path/to/certs/localhost.unecrypted.key&cert=/path/to/certs/localhost.crt'现在,当我访问https://localhost:9292或https://127.0.0.1:9292时,浏览器只是旋转并且没有来自服务器的响应。不返回任何资源。它两次向我显示HTML标题标签,但几乎总是什么也得不到。有什么想法吗?其他想法?确实需要在本地运行此应
我有一个模型User,它在创建后的回调中创建了选项#Userhas_one:user_optionsafter_create:create_optionsprivatedefcreate_optionsUserOptions.create(user:self)end我对此有一些简单的Rspec覆盖:describe"newuser"doit"createsuser_optionsaftertheuseriscreated"douser=create(:user)user.user_options.shouldbe_kind_of(UserOptions)endend一切正常,直到我将自
在安装了openssllib的linux机器上,当您执行带有“-nodes”选项的“opensslpkcs12”时,您将获得带有未加密私钥的输出,但如果您跳过–nodes选项,则输出将具有加密的私钥。e.g.opensslpkcs12-intest.pfx-outtest.pem你应该看到像下面这样加密的私钥-----BEGINENCRYPTEDPRIVATEKEY-----MIIFDjBABgkqhkiGG7s=-----ENDENCRYPTEDPRIVATEKEY-----如何使用ruby的开放ssl库实现上述目标?这就是我用ruby生成私钥的方式:@private_key
我正在尝试使用RubyEventMachine访问使用SSL证书身份验证的HTTPSWeb服务,但我没有让它工作。我编写了以下简单代码块来对其进行端到端测试:require'rubygems'require'em-http'EventMachine.rundourl='https://foobar.com/'ssl_opts={:private_key_file=>'/tmp/private.key',:cert_chain_file=>'/tmp/ca.pem',:verify_peer=>false}http=EventMachine::HttpRequest.new(url).g
我正在努力让Savongem连接到我们的一台服务器。我不断收到一条错误消息,指出我无法通过ssl。我已经阅读了许多教程和修复程序,但似乎都没有用。感谢任何帮助-如果我能度过它,这将成为我的星期一:-)。错误:D,[2011-06-20T09:43:02.002993#10328]DEBUG--:RetrievingWSDLfrom:http://path_to_wsdl:4443/sm/services/mailing/2009/03/02?wsdlD,[2011-06-20T09:43:02.129057#10328]DEBUG--:HTTPIexecutesHTTPGETusing