Return type of the key

This commit is contained in:
Sergey Abramchuk
2017-09-07 14:35:33 +03:00
parent 69718e1e74
commit 8b390e969f
2 changed files with 7 additions and 0 deletions

View File

@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h>
#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;

View File

@@ -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];