gpt4 book ai didi

ios - 设置 Rails 4 SSL Webrick 本地主机以与 iOS 9 一起工作

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:34:51 25 4
gpt4 key购买 nike

首先我关注了这个 http://underthehood.carwow.co.uk/httpsssl-in-your-local-rails-4-1-development-environment/让我的 Rails 应用程序接受 https 请求,从浏览器执行 GET 时效果很好。我唯一不能做的就是将 localhost.crt 添加到系统证书中(我的链接中的第 3 步)。当我尝试拖动它时,它会询问我的密码,但当我开始输入时,就像我的键盘被禁用一样,我无法输入任何内容。

但是当我尝试从 iPhone 6s 模拟器 (iOS 9) 访问它时,它不起作用。

服务器错误:

ERROR OpenSSL::SSL::SSLError: SSL_accept returned=1 errno=0 state=error: no shared cipher
/Users/rodrigoruiz/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/openssl/ssl.rb:236:in `accept'

客户端错误(iPhone模拟器):

Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9824, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSUnderlyingError=0x7fd0dab15a80 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9824, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9824}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://localhost:3000/login_with_facebook.json, NSErrorFailingURLStringKey=https://localhost:3000/login_with_facebook.json, _kCFStreamErrorDomainKey=3}

我该如何解决?

最佳答案

尝试将证书文件 localhost.crt 拖放到模拟器中。

参见:https://stackoverflow.com/a/20047835/242933

更新以回应您的评论:

我没有看到第三步的图片。我不记得必须输入密码。尝试从桌面上的目录中生成 localhost.crt。不要使用 sudo。然后,将 localhost.crt 从您桌面上的目录(而不是从 Keychain Access)拖到您的 iPhone 模拟器中。

这是我用来生成证书的脚本(名为 create_self-signed_ssl_certificate.sh),我将其命名为 server.crt 而不是 localhost.crt.

#!/bin/sh

# Create a Self-Signed SSL Certificate
openssl genrsa -aes256 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -sha256 -key server.key -out server.csr -subj /CN=localhost
openssl x509 -req -sha512 -days 365 -in server.csr -signkey server.key -out server.crt

关于ios - 设置 Rails 4 SSL Webrick 本地主机以与 iOS 9 一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32941347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com