Skip to content

Commit

Permalink
Darwin: Allow partial validation of DAC and CD (for external cloud or…
Browse files Browse the repository at this point in the history
… custom app based validation) (project-chip#22115)
  • Loading branch information
sharadb-amazon authored and isiu-apple committed Sep 16, 2022
1 parent 4227e7a commit f035777
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/darwin/Framework/CHIP/MTRDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NS
* Sets this MTRDeviceController to use the given issuer for issuing operational certs. By default, the MTRDeviceController uses an
* internal issuer.
*
* When a nocChainIssuer is set, the device commissioner will delegate verification to the chip::Credentials::PartialDACVerifier so
* that DAC chain and CD validation can be performed by custom code triggered by MTRNOCChainIssuer.onNOCChainGenerationNeeded().
* Otherwise, the device commissioner uses the chip::Credentials::DefaultDACVerifier
*
* @param[in] nocChainIssuer the NOC Chain issuer to use for issuer operational certs
*
* @param[in] queue The queue on which the callbacks will be delivered
Expand Down
9 changes: 8 additions & 1 deletion src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <controller/CommissioningWindowOpener.h>
#include <credentials/FabricTable.h>
#include <credentials/GroupDataProvider.h>
#include <credentials/attestation_verifier/DacOnlyPartialAttestationVerifier.h>
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
#include <lib/core/CHIPVendorIdentifiers.hpp>
#include <platform/PlatformManager.h>
Expand Down Expand Up @@ -77,6 +78,7 @@ @interface MTRDeviceController ()
@property (atomic, readonly) dispatch_queue_t chipWorkQueue;

@property (readonly) chip::Controller::DeviceCommissioner * cppCommissioner;
@property (readonly) chip::Credentials::PartialDACVerifier * partialDACVerifier;
@property (readonly) MTRDevicePairingDelegateBridge * pairingDelegateBridge;
@property (readonly) MTROperationalCredentialsDelegate * operationalCredentialsDelegate;
@property (readonly) MTRP256KeypairBridge signingKeypairBridge;
Expand Down Expand Up @@ -664,7 +666,12 @@ - (void)setNocChainIssuer:(id<MTRNOCChainIssuer>)nocChainIssuer queue:(dispatch_
dispatch_sync(_chipWorkQueue, ^{
VerifyOrReturn([self checkIsRunning]);

self->_operationalCredentialsDelegate->SetNocChainIssuer(nocChainIssuer, queue);
if (nocChainIssuer != nil) {
self->_operationalCredentialsDelegate->SetNocChainIssuer(nocChainIssuer, queue);
self->_cppCommissioner->SetDeviceAttestationVerifier(_partialDACVerifier);
} else {
self->_cppCommissioner->SetDeviceAttestationVerifier(chip::Credentials::GetDeviceAttestationVerifier());
}
});
}

Expand Down

0 comments on commit f035777

Please sign in to comment.