-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Credentials::ConvertX509CertToChipCert
to Obj-C.
#22113
Expose Credentials::ConvertX509CertToChipCert
to Obj-C.
#22113
Conversation
PR #22113: Size comparison from fa24ab6 to 38aca9f Increases (2 builds for cc13x2_26x2, cyw30739)
Decreases (5 builds for cc13x2_26x2, esp32, nrfconnect, psoc6, telink)
Full report (32 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, telink)
|
38aca9f
to
855fb96
Compare
PR #22113: Size comparison from 82d974b to cc99e18 Increases (6 builds for bl602, cc13x2_26x2, esp32, psoc6)
Decreases (4 builds for bl602, cc13x2_26x2, psoc6, telink)
Full report (32 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, telink)
|
+ (nullable NSData *)convertToCHIPCertFromX509Cert:(NSData *)x509Certificate | ||
{ | ||
|
||
chip::ByteSpan x509CertBytes = chip::ByteSpan((uint8_t *) x509Certificate.bytes, x509Certificate.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use AsByteSpan().
|
||
chip::ByteSpan x509CertBytes = chip::ByteSpan((uint8_t *) x509Certificate.bytes, x509Certificate.length); | ||
|
||
NSMutableData * chipCertBuffer = [[NSMutableData alloc] initWithLength:chip::Credentials::kMaxCHIPCertLength]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a stack buffer.
if (errorCode != CHIP_NO_ERROR) | ||
return nil; | ||
|
||
return [NSData dataWithBytes:chipCertBytes.data() length:chipCertBytes.size()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use AsData
.
@@ -125,6 +125,9 @@ NS_ASSUME_NONNULL_BEGIN | |||
+ (nullable NSData *)generateCertificateSigningRequest:(id<MTRKeypair>)keypair | |||
error:(NSError * __autoreleasing _Nullable * _Nullable)error; | |||
|
|||
/** Converts the given X.509v3 certificate to the CHIP certificate format. */ | |||
+ (nullable NSData *)convertToCHIPCertFromX509Cert:(NSData *)x509Certificate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to document when null is returned.
…ip#22113) * Expose `Credentials::ConvertX509CertToChipCert` to Obj-C. * Restyled by clang-format Co-authored-by: Restyled.io <[email protected]>
Problem
Credentials::ConvertX509CertToChipCert
to Obj-C.Change overview
Added function
convertToCHIPCertFromX509Cert
toMTRCertificates
to exposeCredentials::ConvertX509CertToChipCert
to Obj-C.