Certificate usage support for https

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19911 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-08-24 09:16:58 +00:00
parent 71a8c69719
commit b480d424c4
4 changed files with 43 additions and 0 deletions

View file

@ -12,6 +12,11 @@
obtain handle for specific network link in use by a connection,
and invalidate it when the connection is iunvaliodated.
Fixes bug #9798
* Headers/Foundation/NSURLHandle.h:
* Source/GSHTTPURLHandle.m:
* Source/NSURLHandle.m: Add new property keys for setting certificate
information for https. Stopgap until we can clone newer MacOS-X
features.
2004-08-23 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -90,6 +90,25 @@ GS_EXPORT NSString * const GSHTTPPropertyProxyHostKey;
* obtain proxy port.
*/
GS_EXPORT NSString * const GSHTTPPropertyProxyPortKey;
/**
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
* specify the location of an SSL certificate file.
*/
GS_EXPORT NSString * const GSHTTPSCertificateFileKey;
/**
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
* specify the location of an SSL key file.
*/
GS_EXPORT NSString * const GSHTTPSKeyFileKey;
/**
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
* specify the password for an SSL key file.
*/
GS_EXPORT NSString * const GSHTTPSKeyPasswordKey;
#endif
/**

View file

@ -514,6 +514,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
if ([[url scheme] isEqualToString: @"https"])
{
NSString *cert;
if (sslClass == 0)
{
[self backgroundLoadDidFailWithReason:
@ -523,6 +525,14 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
sock = [sslClass fileHandleAsClientInBackgroundAtAddress: host
service: port
protocol: s];
cert = [request objectForKey: GSHTTPSCertificateFileKey];
if ([cert length] > 0)
{
NSString *key = [request objectForKey: GSHTTPSKeyFileKey];
NSString *pwd = [request objectForKey: GSHTTPSKeyPasswordKey];
[sock sslSetCertificate: cert privateKey: key PEMpasswd: pwd];
}
}
else
{

View file

@ -73,6 +73,15 @@ NSString * const GSHTTPPropertyProxyHostKey
NSString * const GSHTTPPropertyProxyPortKey
= @"GSHTTPPropertyProxyPortKey";
NSString * const GSHTTPSCertificateFileKey
= @"GSHTTPSCertificateFileKey";
NSString * const GSHTTPSKeyFileKey
= @"GSHTTPSKeyFileKey";
NSString * const GSHTTPSKeyPasswordKey
= @"GSHTTPSKeyPasswordKey";
/**
* <p>