Implement parsing certificate DER data

This commit is contained in:
Sergey Abramchuk
2017-09-06 18:18:36 +03:00
parent 062b07a957
commit 5f1343f7f2
+12 -1
View File
@@ -35,6 +35,10 @@
int result = mbedtls_x509_crt_parse(certificate.crt, (const unsigned char *)pemString.UTF8String, pemData.length + 1); int result = mbedtls_x509_crt_parse(certificate.crt, (const unsigned char *)pemString.UTF8String, pemData.length + 1);
if (result != 0) { if (result != 0) {
if (error) {
// TODO: Return parse error
}
return nil; return nil;
} }
@@ -44,7 +48,14 @@
+ (OpenVPNCertificate *)certificateWithDER:(NSData *)derData error:(out NSError * __nullable * __nullable)error { + (OpenVPNCertificate *)certificateWithDER:(NSData *)derData error:(out NSError * __nullable * __nullable)error {
OpenVPNCertificate *certificate = [OpenVPNCertificate new]; OpenVPNCertificate *certificate = [OpenVPNCertificate new];
// TODO: Parse DER data int result = mbedtls_x509_crt_parse_der(certificate.crt, derData.bytes, derData.length);
if (result != 0) {
if (error) {
// TODO: Return parse error
}
return nil;
}
return certificate; return certificate;
} }