mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Implement parsing certificate DER data
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user