/src/connectedhomeip/examples/all-clusters-app/all-clusters-common/include/tls-certificate-management-instance.h
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * Copyright (c) 2025 Project CHIP Authors |
4 | | * All rights reserved. |
5 | | * |
6 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | | * you may not use this file except in compliance with the License. |
8 | | * You may obtain a copy of the License at |
9 | | * |
10 | | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | | * |
12 | | * Unless required by applicable law or agreed to in writing, software |
13 | | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | | * See the License for the specific language governing permissions and |
16 | | * limitations under the License. |
17 | | */ |
18 | | |
19 | | #pragma once |
20 | | |
21 | | #include <app/clusters/tls-certificate-management-server/tls-certificate-management-server.h> |
22 | | |
23 | | namespace chip { |
24 | | namespace app { |
25 | | namespace Clusters { |
26 | | |
27 | | /** |
28 | | * The application delegate to define the options & implement commands. |
29 | | */ |
30 | | class TlsCertificateManagementCommandDelegate : public TlsCertificateManagementDelegate |
31 | | { |
32 | | static TlsCertificateManagementCommandDelegate instance; |
33 | | Tls::CertificateTable & mCertificateTable; |
34 | | |
35 | | public: |
36 | 2 | TlsCertificateManagementCommandDelegate(Tls::CertificateTable & certificateTable) : mCertificateTable(certificateTable) {} |
37 | | ~TlsCertificateManagementCommandDelegate() = default; |
38 | | |
39 | | Protocols::InteractionModel::ClusterStatusCode ProvisionRootCert(EndpointId matterEndpoint, FabricIndex fabric, |
40 | | const ProvisionRootCertificateType & provisionReq, |
41 | | Tls::TLSCAID & outCaid) override; |
42 | | |
43 | | CHIP_ERROR LoadedRootCerts(EndpointId matterEndpoint, FabricIndex fabric, |
44 | | LoadedRootCertificateCallback loadedCallback) const override; |
45 | | CHIP_ERROR RootCertsForFabric(EndpointId matterEndpoint, FabricIndex fabric, |
46 | | RootCertificateListCallback loadedCallback) const override; |
47 | | |
48 | | CHIP_ERROR FindRootCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id, |
49 | | LoadedRootCertificateCallback loadedCallback) const override; |
50 | | CHIP_ERROR LookupRootCertByFingerprint(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan & fingerprint, |
51 | | LoadedRootCertificateCallback loadedCallback) const override; |
52 | | CHIP_ERROR LookupRootCert(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan & certificate, |
53 | | LoadedRootCertificateCallback loadedCallback) const override; |
54 | | Protocols::InteractionModel::Status RemoveRootCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCAID id) override; |
55 | | |
56 | | Protocols::InteractionModel::Status GenerateClientCsr(EndpointId matterEndpoint, FabricIndex fabric, |
57 | | const ClientCsrType & request, |
58 | | GeneratedCsrCallback loadedCallback) const override; |
59 | | Protocols::InteractionModel::ClusterStatusCode |
60 | | ProvisionClientCert(EndpointId matterEndpoint, FabricIndex fabric, |
61 | | const ProvisionClientCertificateType & provisionReq) override; |
62 | | |
63 | | CHIP_ERROR LoadedClientCerts(EndpointId matterEndpoint, FabricIndex fabric, |
64 | | LoadedClientCertificateCallback loadedCallback) const override; |
65 | | CHIP_ERROR ClientCertsForFabric(EndpointId matterEndpoint, FabricIndex fabric, |
66 | | ClientCertificateListCallback loadedCallback) const override; |
67 | | |
68 | | CHIP_ERROR FindClientCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id, |
69 | | LoadedClientCertificateCallback loadedCallback) const override; |
70 | | CHIP_ERROR LookupClientCertByFingerprint(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan & fingerprint, |
71 | | LoadedClientCertificateCallback loadedCallback) const override; |
72 | | CHIP_ERROR LookupClientCert(EndpointId matterEndpoint, FabricIndex fabric, const ByteSpan & certificate, |
73 | | LoadedClientCertificateCallback loadedCallback) const override; |
74 | | Protocols::InteractionModel::Status RemoveClientCert(EndpointId matterEndpoint, FabricIndex fabric, Tls::TLSCCDID id) override; |
75 | | |
76 | 2 | static inline TlsCertificateManagementCommandDelegate & getInstance() { return instance; } |
77 | | }; |
78 | | |
79 | | } // namespace Clusters |
80 | | } // namespace app |
81 | | } // namespace chip |