From 8b390e969ff522b36f4927dcb5ae508ab733a2ac Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Thu, 7 Sep 2017 14:35:33 +0300 Subject: [PATCH] Return type of the key --- OpenVPN Adapter/OpenVPNPrivateKey.h | 3 +++ OpenVPN Adapter/OpenVPNPrivateKey.m | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/OpenVPN Adapter/OpenVPNPrivateKey.h b/OpenVPN Adapter/OpenVPNPrivateKey.h index eeda4ec..81ca5f6 100644 --- a/OpenVPN Adapter/OpenVPNPrivateKey.h +++ b/OpenVPN Adapter/OpenVPNPrivateKey.h @@ -8,6 +8,8 @@ #import +#import "OpenVPNKeyType.h" + @interface OpenVPNPrivateKey : NSObject + (nullable OpenVPNPrivateKey *)keyWithPEM:(nonnull NSData *)pemData @@ -21,6 +23,7 @@ - (nonnull instancetype) __unavailable init; @property (nonatomic, readonly) NSInteger size; +@property (nonatomic, readonly) OpenVPNKeyType type; - (nullable NSData *)pemData:(out NSError * __nullable * __nullable)error; - (nullable NSData *)derData:(out NSError * __nullable * __nullable)error; diff --git a/OpenVPN Adapter/OpenVPNPrivateKey.m b/OpenVPN Adapter/OpenVPNPrivateKey.m index a72d3e0..03f8c2e 100644 --- a/OpenVPN Adapter/OpenVPNPrivateKey.m +++ b/OpenVPN Adapter/OpenVPNPrivateKey.m @@ -33,6 +33,10 @@ return mbedtls_pk_get_bitlen(self.ctx); } +- (OpenVPNKeyType)type { + return (OpenVPNKeyType)mbedtls_pk_get_type(self.ctx); +} + + (nullable OpenVPNPrivateKey *)keyWithPEM:(NSData *)pemData password:(NSString *)password error:(out NSError **)error { OpenVPNPrivateKey *key = [OpenVPNPrivateKey new];