mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-23 16:39:02 +00:00
implemented cert and keypair gen
This commit is contained in:
34
Limelight/CryptoManager.m
Normal file
34
Limelight/CryptoManager.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// CryptoManager.m
|
||||
// Limelight
|
||||
//
|
||||
// Created by Diego Waxemberg on 10/14/14.
|
||||
// Copyright (c) 2014 Limelight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CryptoManager.h"
|
||||
#import "mkcert.h"
|
||||
|
||||
|
||||
@implementation CryptoManager
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void) generateKeyPairUsingSSl {
|
||||
NSLog(@"Generating Certificate: ");
|
||||
CertKeyPair certKeyPair = generateCertKeyPair();
|
||||
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||
NSString *certFile = [documentsDirectory stringByAppendingPathComponent:@"client.crt"];
|
||||
NSString *keyPairFile = [documentsDirectory stringByAppendingPathComponent:@"client.key"];
|
||||
|
||||
NSLog(@"Writing cert and key to: \n%@\n%@", certFile, keyPairFile);
|
||||
saveCertKeyPair([certFile UTF8String], [keyPairFile UTF8String], certKeyPair);
|
||||
freeCertKeyPair(certKeyPair);
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user