Apply style guide rules to certificate, key and reachability classes

This commit is contained in:
Sergey Abramchuk
2018-01-18 17:00:28 +03:00
parent eff0bccfef
commit 7078de3bae
9 changed files with 63 additions and 59 deletions
+13 -14
View File
@@ -7,8 +7,8 @@
//
#import "OpenVPNCertificate.h"
#import <mbedtls/x509_crt.h>
#import <mbedtls/pem.h>
#include <mbedtls/x509_crt.h>
#include <mbedtls/pem.h>
#import "NSError+OpenVPNError.h"
@@ -20,16 +20,6 @@
@implementation OpenVPNCertificate
- (instancetype)init
{
self = [super init];
if (self) {
self.crt = malloc(sizeof(mbedtls_x509_crt));
mbedtls_x509_crt_init(self.crt);
}
return self;
}
+ (OpenVPNCertificate *)certificateWithPEM:(NSData *)pemData error:(out NSError **)error {
OpenVPNCertificate *certificate = [OpenVPNCertificate new];
@@ -62,6 +52,15 @@
return certificate;
}
- (instancetype)init
{
if (self = [super init]) {
_crt = malloc(sizeof(mbedtls_x509_crt));
mbedtls_x509_crt_init(_crt);
}
return self;
}
- (NSData *)pemData:(out NSError **)error {
NSString *header = @"-----BEGIN CERTIFICATE-----\n";
NSString *footer = @"-----END CERTIFICATE-----\n";
@@ -102,8 +101,8 @@
}
- (void)dealloc {
mbedtls_x509_crt_free(self.crt);
free(self.crt);
mbedtls_x509_crt_free(_crt);
free(_crt);
}
@end