Return size of the key in bits

This commit is contained in:
Sergey Abramchuk
2017-09-07 14:26:05 +03:00
parent a346e0c51a
commit 8ead0babeb
2 changed files with 6 additions and 0 deletions

View File

@@ -20,6 +20,8 @@
- (nonnull instancetype) __unavailable init;
@property (nonatomic, readonly) NSInteger size;
- (nullable NSData *)pemData:(out NSError * __nullable * __nullable)error;
- (nullable NSData *)derData:(out NSError * __nullable * __nullable)error;

View File

@@ -29,6 +29,10 @@
return self;
}
- (NSInteger)size {
return mbedtls_pk_get_bitlen(self.ctx);
}
+ (nullable OpenVPNPrivateKey *)keyWithPEM:(NSData *)pemData password:(NSString *)password error:(out NSError **)error {
OpenVPNPrivateKey *key = [OpenVPNPrivateKey new];