Re: NSStream SSL Help
Re: NSStream SSL Help
- Subject: Re: NSStream SSL Help
- From: "Dominik Pich" <email@hidden>
- Date: Thu, 6 Mar 2008 01:07:28 +0100
sorry no idea..I dropped down to CFStream.
----- Original Message -----
From: "Eric Scharff" <email@hidden>
To: <email@hidden>
Sent: Wednesday, March 05, 2008 9:24 PM
Subject: NSStream SSL Help
var YAHOO = {'Shortcuts' : {}};
YAHOO.Shortcuts.hasSensitiveText = false;
YAHOO.Shortcuts.sensitivityType = [];
YAHOO.Shortcuts.doUlt = false;
YAHOO.Shortcuts.location = "us";
YAHOO.Shortcuts.document_id = 0;
YAHOO.Shortcuts.document_type = "";
YAHOO.Shortcuts.document_title = "Does NSStream\x5c\x27s SSL or TLS
support work?";
YAHOO.Shortcuts.document_publish_date = "";
YAHOO.Shortcuts.document_author = "email@hidden";
YAHOO.Shortcuts.document_url = "";
YAHOO.Shortcuts.document_tags = "";
YAHOO.Shortcuts.annotationSet = {
"lw_1204748497_0": {
"text": "www.apple.com",
"extended": 0,
"startchar": 468,
"endchar": 480,
"start": 468,
"end": 480,
"extendedFrom": "",
"predictedCategory": "",
"predictionProbability": "0",
"weight": 1,
"type": ["shortcuts:/us/place/virtual/web_site"],
"category": ["IDENTIFIER"],
"context": "to a site who I know has a valid certificate (www.apple.com
port 443), I get the error code NSUnknownErrorDomain error -9843" },
"lw_1204748497_1": {
"text": "http://www.yahoo.com/r/hs",
"extended": 0,
"startchar": 3345,
"endchar": 3369,
"start": 3345,
"end": 3369,
"extendedFrom": "",
"predictedCategory": "",
"predictionProbability": "0",
"weight": 1,
"type": ["shortcuts:/us/instance/identifier/hyperlink/http"],
"category": ["IDENTIFIER"],
"context": "Eric
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs",
"metaData": {
"linkHref": "http://www.yahoo.com/r/hs",
"linkProtocol": "http",
"linkTarget": "_blank"
}
}I am trying to get a basic test of NSStream TLS support working.
Eventually, I want to send TLS encrypted data over an arbitrary port, but
to test, I figured I'd try to make an SSL connection as an example.
Even if I connect to a site who I know has a valid certificate
(www.apple.com port 443), I get the error code NSUnknownErrorDomain
error -9843. sent to my callback. This error seems to correspond to
errSSLHostNameMismatch in SecureTransport.h (peer host name mismatch).
This doesn't make sense because TLS shouldn't require host name
verification anyway, and I'm sure that the server's SSL certificate is
valid.
Has anyone successfully used NSStream to talk SSL? I'd really like to use
this non-blocking API rather than relying, for example, on a blocking
OpenSSL based API.
My initialization code is below:
[NSStream getStreamsToHost: [NSHost hostWithName: [serverName
stringValue]] port: [serverPort intValue] inputStream: &fileInStream
outputStream: &fileOutStream];
if ((fileInStream != nil) && (fileOutStream != nil)) {
[fileInStream retain];
[fileOutStream retain];
[fileInStream setProperty: NSStreamSocketSecurityLevelTLSv1
forKey: NSStreamSocketSecurityLevelKey];
[fileOutStream setProperty: NSStreamSocketSecurityLevelTLSv1
forKey: NSStreamSocketSecurityLevelKey];
// [fileInStream setProperty:
NSStreamSocketSecurityLevelNegotiatedSSL forKey:
NSStreamSocketSecurityLevelKey];
// [fileOutStream setProperty:
NSStreamSocketSecurityLevelNegotiatedSSL forKey:
NSStreamSocketSecurityLevelKey];
[fileInStream setDelegate: self];
[fileOutStream setDelegate: self];
[fileInStream scheduleInRunLoop: [NSRunLoop currentRunLoop]
forMode: NSDefaultRunLoopMode];
[fileOutStream scheduleInRunLoop: [NSRunLoop currentRunLoop]
forMode: NSDefaultRunLoopMode];
[fileInStream open];
[fileOutStream open];
}
Any help would be GREATLY appreciated.
Thanks,
-Eric
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden