mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Apply style guide rules to certificate, key and reachability classes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user