Tag: SSL

AFNet使用TLSvalidation自签名服务器根CA的问题

这是一个试图为我的特定用例find解决scheme的问题,并logging我为尝试遵循这个过程的其他人所做的努力。 我们有一个RESTful服务器和一个iOS应用程序。 我们有自己的证书颁发机构,服务器有一个根证书颁发机构和一个自签名证书。 我们遵循这个过程来生成以下文件: Creating Your Own SSL Certificate Authority (and Dumping Self Signed Certs) rootCA.pem rootCA.key server.crt server.key 只有服务器证书存储在我们的服务器上,并且作为SSL过程的一部分,公钥与API调用一起被发送以进行validation。 我遵循这个过程来使用AFNetworking来使用证书locking以及公钥locking来validation我们的自签名证书: http://initwithfunk.com/blog/2014/03/12/afnetworking-ssl-pinning-with-self-signed-certificates/ 根据本指南,将.crt文件转换为.cer文件(DER格式): https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them 并将.cer文件(server.cer)包含在iOS应用程序包中。 这成功地允许我们的应用程序向我们的服务器发出GET / POST请求。 但是,由于我们的服务器证书可能会过期或重新发布,因此我们想要使用根CA,就像AFNetworking上的此线程中的人员所做的那样: https://github.com/AFNetworking/AFNetworking/issues/1944 目前我们已经更新到AFNetworking 2.6.0,所以我们的networking库应该包括所有的更新,包括在这个讨论中的: https://github.com/AFNetworking/AFNetworking/issues/2744 用于创build我们的安全策略的代码: var manager: AFHTTPRequestOperationManager = AFHTTPRequestOperationManager() manager.requestSerializer = AFJSONRequestSerializer() // force serializer to use JSON encoding let policy: AFSecurityPolicy = AFSecurityPolicy(pinningMode: AFSSLPinningMode.PublicKey) var […]

警告:stream_socket_client():无法设置私钥文件

无法得到这个得到这些错误时,在PHPterminal运行PHP simplepush.php Warning: stream_socket_client(): Unable to set private key file `/users/accenture/Desktop/newAPNS/ck.pem' in /users/accenture/Desktop/newAPNS/simplepush.php on line 22 Warning: stream_socket_client(): failed to create an SSL handle in /users/accenture/Desktop/newAPNS/simplepush.php on line 22 Warning: stream_socket_client(): Failed to enable crypto in /users/accenture/Desktop/newAPNS/simplepush.php on line 22 Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /users/accenture/Desktop/newAPNS/simplepush.php on line 22 Failed […]

“CFNetwork SSLHandshake失败(-9807)”与“exception域”中的本地IP

我正在尝试在OS X和iOS(8.1版本)上使用openssl之间的SSL TCP连接。 Exception Domains有192.168.0.104 。 Swift iOS代码: class SSLSocketLite { // The input stream. private var inStream: NSInputStream? // The output stream. private var outStream: NSOutputStream? // The host to connect to. private var host: String // The port to connect on. private var port: Int init(inHost:String, inPort:Int) { host = inHost port = […]

SecPKCS12Import不返回任何项目

我想为我的iOS 6应用程序的钥匙串添加一些TLSvalidation的CA证书。 证书包含在应用程序包中。 我不想添加几个例子中描述的任何身份 (私钥/证书组合)。 SecPKCS12Import调用不会返回任何错误,但不幸的是它也不会返回任何证书。 为了让您重现我的步骤,我以Google中间证书(“Google Internet Authority”)为例,在下载的PEM证书上运行以下命令: 。 #convert PEM certificate to PKCS12 openssl pkcs12 -export -in google.pem -nokeys -out google.p12 -passout "pass:google" #verification openssl pkcs12 -in google.p12 -passin "pass:google" MAC verified OK Bag Attributes: <No Attributes> subject=/C=US/O=Google Inc/CN=Google Internet Authority issuer=/C=US/O=Equifax/OU=Equifax Secure Certificate Authority —–BEGIN CERTIFICATE—– MIICsDCCAhmgAwIBAgIDFXfhMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0 […] ARlIjNvrPq86fpVg0NOTawALkSqOUMl3MynBQO+spR7EHcRbADQ/JemfTEh2Ycfl vZqhEFBfurZkX0eTANq98ZvVfpg= —–END […]

设置支持SNI的TLS1.2连接

我们正在尝试设置TLS1.2连接。 已经在Macbook下载了最新的OpenSSL。 使用此代码创buildTLS1.2连接。 但是,这个特定的线路可能会导致问题。 它使用TLSv1。 /* ———————————————————- * * Set SSLv2 client hello, also announce SSLv3 and TLSv1 * * ———————————————————- */ method = SSLv23_client_method(); 尝试了TLSv1_2_client_method()方法,但它给出了下面的链接错误: 体系结构x86_64的未定义符号:“_TLSv1_2_client_method”,引用来自:sslconnect-7aa462.o中的_main 如果有人可以协助创buildTLS1.2连接,然后从目标C调用(如果需要对套接字编程进行一些特殊处理),那将是非常有帮助的。 [请注意,我不是一个iOS的人。 我正在帮助一个团队解决问题。 也是自己的socket编程新手,虽然团队有一些经验。

Xcode机器人安装链接请求超时

我已经能够让我的Xcode机器人成功集成并创build一个.ipa文件。 我有一个SSL证书安装在我的Xcode服务器,我可以连接到Xcode /机器人url罚款。 当我通过iPad连接到url时,我首先被提示安装一个证书,但是它说没有用红色validation(见附件) 在设备上安assembly置文件后,xcode / bots页面有一个绿色的“安装”button。 一旦我点击“安装”button,它永远不会加载应用程序,几分钟后,我得到一个“无法连接到xx.yy.com” 任何想法可能是什么?

FireBase错误-9806,SSL错误-1200

我正在使用2016年I / O上推出的新的FireBase SDK,并且在与我的应用程序集成后出现此错误。 这发生在应用程序启动。 2016-08-06 06:28:06.237 MyApp[49084:2511094] CFNetwork SSLHandshake failed (-9806) 2016-08-06 06:28:06.238 MyApp[49084:2511094] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806) 2016-08-06 06:28:06.453 MyApp[49084:2511094] CFNetwork SSLHandshake failed (-9806) 2016-08-06 06:28:06.454 MyApp[49084:2511094] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806) 2016-08-06 06:28:06.854 MyApp[49084:2510825] <Firebase/Network/ERROR> Encounter network error. Error: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a […]

在iOS模拟器上使用localhost的CFNetwork SSLHandshake失败(-9807)

我正尝试使用TCP SSL连接openssl s_server和iOS客户端,但获取CFNetwork SSLHandshake failed (-9807) 。 Objective-C代码( 从这里 ): – (void)viewDidLoad { [super viewDidLoad]; printf("method started \n"); NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSData *iosTrustedCertDerData = [NSData dataWithContentsOfFile:[bundle pathForResource:@"servercert" ofType:@"der"]]; OSStatus err = noErr; SecCertificateRef cert; cert = SecCertificateCreateWithData(NULL, (CFDataRef) iosTrustedCertDerData); assert(cert != NULL); CFTypeRef result; NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: (id)kSecClassCertificate, kSecClass, cert, […]

是否有可能使用ios中的安全框架生成证书签名请求(.csr)?

我想要使​​用服务器的https请求客户端证书身份validation。 我看着这个NSURLConnection身份validation挑战创build一个SecCertificateRef 。 它按预期工作。 但是,需要准备包含私钥的p12文件。 它会被securied,因为它需要使用SecPKCS12Import()导入p12文件的密码。 但是,可以有其他的select。 这就是ios客户端应该做一个证书签名请求(.CSR),让第三方(这将是服务器)签名。 对于我的search,我看到我可以使用SecKeyGeneratePair()生成密钥对。 但是我没有看到任何生成CSR的API。 这是否真的需要openssl来实现呢? 另外,有一点closures的话题,一旦ios客户端以某种方式取回签名的证书。 我可以使用SecCertificateCreateWithData()来检索一个SecCertificateRef() 。 但要填写NSURLCredential 。 我还需要使用SecPKCS12Import()从p12文件来的SecPKCS12Import() 。 我怎样才能retreve SecIdentityRef没有SecPKCS12Import()而只是像crt或der证书文件?

与NSURLSession的IOS9 SSL错误

我开发了一个IOS应用程序,使用HTTPs与服务器通信(我也是服务器的开发者,它embedded了一个Tomcat服务器)。 这个应用程序没有任何IOS8的问题,但它不与IOS9。 发送HTTP请求时出现以下错误: Session download has failed : Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x7fa9c44b2e40 {NSErrorFailingURLStringKey=https://127.0.0.1:8443/MyServer/MyApp, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://127.0.0.1:8443/MyServer/MyApp, _kCFStreamErrorCodeKey=-9802, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made.} […]