Skip to content

Commit 72b6990

Browse files
authored
[Camera] Enable TLS clusters (project-chip#40549)
1 parent 4befae1 commit 72b6990

3 files changed

Lines changed: 680 additions & 5 deletions

File tree

examples/camera-app/camera-common/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ config("config") {
2222
chip_data_model("camera-common") {
2323
zap_file = "camera-app.zap"
2424
is_server = true
25+
26+
public_deps = [
27+
"${chip_root}/src/app/clusters/tls-certificate-management-server",
28+
"${chip_root}/src/app/clusters/tls-certificate-management-server:certificate-table",
29+
"${chip_root}/src/crypto",
30+
]
2531
}
2632

2733
source_set("camera-lib") {

examples/camera-app/camera-common/camera-app.matter

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,6 +3205,189 @@ provisional cluster Chime = 1366 {
32053205
command PlayChimeSound(): DefaultSuccess = 0;
32063206
}
32073207

3208+
/** This Cluster is used to manage TLS Client Certificates and to provision
3209+
TLS endpoints with enough information to facilitate subsequent connection. */
3210+
provisional cluster TlsCertificateManagement = 2049 {
3211+
revision 1;
3212+
3213+
enum StatusCodeEnum : enum8 {
3214+
kCertificateAlreadyInstalled = 2;
3215+
kDuplicateKey = 3;
3216+
}
3217+
3218+
fabric_scoped struct TLSCertStruct {
3219+
int16u caid = 0;
3220+
optional long_octet_string<3000> certificate = 1;
3221+
fabric_idx fabricIndex = 254;
3222+
}
3223+
3224+
fabric_scoped struct TLSClientCertificateDetailStruct {
3225+
int16u ccdid = 0;
3226+
optional long_octet_string<3000> clientCertificate = 1;
3227+
optional octet_string intermediateCertificates[] = 2;
3228+
fabric_idx fabricIndex = 254;
3229+
}
3230+
3231+
readonly attribute int8u maxRootCertificates = 0;
3232+
readonly attribute TLSCertStruct provisionedRootCertificates[] = 1;
3233+
readonly attribute int8u maxClientCertificates = 2;
3234+
readonly attribute TLSClientCertificateDetailStruct provisionedClientCertificates[] = 3;
3235+
readonly attribute command_id generatedCommandList[] = 65528;
3236+
readonly attribute command_id acceptedCommandList[] = 65529;
3237+
readonly attribute attrib_id attributeList[] = 65531;
3238+
readonly attribute bitmap32 featureMap = 65532;
3239+
readonly attribute int16u clusterRevision = 65533;
3240+
3241+
request struct ProvisionRootCertificateRequest {
3242+
long_octet_string<3000> certificate = 0;
3243+
nullable int16u caid = 1;
3244+
}
3245+
3246+
response struct ProvisionRootCertificateResponse = 1 {
3247+
int16u caid = 0;
3248+
}
3249+
3250+
request struct FindRootCertificateRequest {
3251+
nullable int16u caid = 0;
3252+
}
3253+
3254+
response struct FindRootCertificateResponse = 3 {
3255+
TLSCertStruct certificateDetails[] = 0;
3256+
}
3257+
3258+
request struct LookupRootCertificateRequest {
3259+
octet_string<64> fingerprint = 0;
3260+
}
3261+
3262+
response struct LookupRootCertificateResponse = 5 {
3263+
int16u caid = 0;
3264+
}
3265+
3266+
request struct RemoveRootCertificateRequest {
3267+
int16u caid = 0;
3268+
}
3269+
3270+
request struct TLSClientCSRRequest {
3271+
octet_string<128> nonce = 0;
3272+
}
3273+
3274+
response struct TLSClientCSRResponse = 8 {
3275+
int16u ccdid = 0;
3276+
long_octet_string<3000> csr = 1;
3277+
octet_string<128> nonce = 2;
3278+
}
3279+
3280+
request struct ProvisionClientCertificateRequest {
3281+
int16u ccdid = 0;
3282+
TLSClientCertificateDetailStruct clientCertificateDetails = 1;
3283+
}
3284+
3285+
request struct FindClientCertificateRequest {
3286+
nullable int16u ccdid = 0;
3287+
}
3288+
3289+
response struct FindClientCertificateResponse = 11 {
3290+
TLSClientCertificateDetailStruct certificateDetails[] = 0;
3291+
}
3292+
3293+
request struct LookupClientCertificateRequest {
3294+
octet_string<64> fingerprint = 0;
3295+
}
3296+
3297+
response struct LookupClientCertificateResponse = 13 {
3298+
int16u ccdid = 0;
3299+
}
3300+
3301+
request struct RemoveClientCertificateRequest {
3302+
int16u ccdid = 0;
3303+
}
3304+
3305+
/** This command SHALL provision a newly provided certificate, or rotate an existing one, based on the contents of the CAID field. */
3306+
fabric command access(invoke: administer) ProvisionRootCertificate(ProvisionRootCertificateRequest): ProvisionRootCertificateResponse = 0;
3307+
/** This command SHALL return the specified TLS root certificate, or all TLS provisioned root certificates, based on the contents of the CAID field. */
3308+
fabric command FindRootCertificate(FindRootCertificateRequest): FindRootCertificateResponse = 2;
3309+
/** This command SHALL return the CAID for the passed in fingerprint. */
3310+
fabric command LookupRootCertificate(LookupRootCertificateRequest): LookupRootCertificateResponse = 4;
3311+
/** This command SHALL be generated to request the server removes the certificate provisioned to the provided Certificate Authority ID. */
3312+
fabric command access(invoke: administer) RemoveRootCertificate(RemoveRootCertificateRequest): DefaultSuccess = 6;
3313+
/** This command SHALL be generated to request the Node generates a Certificate Signing Request. */
3314+
fabric command access(invoke: administer) TLSClientCSR(TLSClientCSRRequest): TLSClientCSRResponse = 7;
3315+
/** This command SHALL be generated to request the Node provisions newly provided Client Certificate Details, or rotate an existing client certificate. */
3316+
fabric command access(invoke: administer) ProvisionClientCertificate(ProvisionClientCertificateRequest): DefaultSuccess = 9;
3317+
/** This command SHALL return the TLSClientCertificateDetailStruct for the passed in CCDID, or all TLS client certificates, based on the contents of the CCDID field. */
3318+
fabric command FindClientCertificate(FindClientCertificateRequest): FindClientCertificateResponse = 10;
3319+
/** This command SHALL return the CCDID for the passed in Fingerprint. */
3320+
fabric command LookupClientCertificate(LookupClientCertificateRequest): LookupClientCertificateResponse = 12;
3321+
/** This command SHALL be used to request the Node removes all stored information for the provided CCDID. */
3322+
fabric command access(invoke: administer) RemoveClientCertificate(RemoveClientCertificateRequest): DefaultSuccess = 14;
3323+
}
3324+
3325+
/** This Cluster is used to provision TLS Endpoints with enough information to facilitate subsequent connection. */
3326+
provisional cluster TlsClientManagement = 2050 {
3327+
revision 1;
3328+
3329+
enum StatusCodeEnum : enum8 {
3330+
kEndpointAlreadyInstalled = 2;
3331+
kRootCertificateNotFound = 3;
3332+
kClientCertificateNotFound = 4;
3333+
kEndpointInUse = 5;
3334+
}
3335+
3336+
enum TLSEndpointStatusEnum : enum8 {
3337+
kProvisioned = 0;
3338+
kInUse = 1;
3339+
}
3340+
3341+
fabric_scoped struct TLSEndpointStruct {
3342+
int16u endpointID = 0;
3343+
octet_string<253> hostname = 1;
3344+
int16u port = 2;
3345+
int16u caid = 3;
3346+
nullable int16u ccdid = 4;
3347+
TLSEndpointStatusEnum status = 5;
3348+
fabric_idx fabricIndex = 254;
3349+
}
3350+
3351+
readonly attribute int8u maxProvisioned = 0;
3352+
readonly attribute TLSEndpointStruct provisionedEndpoints[] = 1;
3353+
readonly attribute command_id generatedCommandList[] = 65528;
3354+
readonly attribute command_id acceptedCommandList[] = 65529;
3355+
readonly attribute attrib_id attributeList[] = 65531;
3356+
readonly attribute bitmap32 featureMap = 65532;
3357+
readonly attribute int16u clusterRevision = 65533;
3358+
3359+
request struct ProvisionEndpointRequest {
3360+
octet_string<253> hostname = 0;
3361+
int16u port = 1;
3362+
int16u caid = 2;
3363+
nullable int16u ccdid = 3;
3364+
nullable int16u endpointID = 4;
3365+
}
3366+
3367+
response struct ProvisionEndpointResponse = 1 {
3368+
int16u endpointID = 0;
3369+
}
3370+
3371+
request struct FindEndpointRequest {
3372+
int16u endpointID = 0;
3373+
}
3374+
3375+
response struct FindEndpointResponse = 3 {
3376+
TLSEndpointStruct endpoint = 0;
3377+
}
3378+
3379+
request struct RemoveEndpointRequest {
3380+
int16u endpointID = 0;
3381+
}
3382+
3383+
/** This command is used to provision a TLS Endpoint for the provided HostName / Port combination. */
3384+
fabric command access(invoke: administer) ProvisionEndpoint(ProvisionEndpointRequest): ProvisionEndpointResponse = 0;
3385+
/** This command is used to find a TLS Endpoint by its ID. */
3386+
fabric command FindEndpoint(FindEndpointRequest): FindEndpointResponse = 2;
3387+
/** This command is used to remove a TLS Endpoint by its ID. */
3388+
fabric command access(invoke: administer) RemoveEndpoint(RemoveEndpointRequest): DefaultSuccess = 4;
3389+
}
3390+
32083391
/** The Fault Injection Cluster provide a means for a test harness to configure faults(for example triggering a fault in the system). */
32093392
internal cluster FaultInjection = 4294048774 {
32103393
revision 1; // NOTE: Default/not specifically set
@@ -3853,6 +4036,50 @@ endpoint 1 {
38534036

38544037
handle command PlayChimeSound;
38554038
}
4039+
4040+
server cluster TlsCertificateManagement {
4041+
callback attribute maxRootCertificates;
4042+
callback attribute provisionedRootCertificates;
4043+
callback attribute maxClientCertificates;
4044+
callback attribute provisionedClientCertificates;
4045+
callback attribute generatedCommandList;
4046+
callback attribute acceptedCommandList;
4047+
callback attribute attributeList;
4048+
ram attribute featureMap default = 0;
4049+
callback attribute clusterRevision;
4050+
4051+
handle command ProvisionRootCertificate;
4052+
handle command ProvisionRootCertificateResponse;
4053+
handle command FindRootCertificate;
4054+
handle command FindRootCertificateResponse;
4055+
handle command LookupRootCertificate;
4056+
handle command LookupRootCertificateResponse;
4057+
handle command RemoveRootCertificate;
4058+
handle command TLSClientCSR;
4059+
handle command TLSClientCSRResponse;
4060+
handle command ProvisionClientCertificate;
4061+
handle command FindClientCertificate;
4062+
handle command FindClientCertificateResponse;
4063+
handle command LookupClientCertificate;
4064+
handle command LookupClientCertificateResponse;
4065+
handle command RemoveClientCertificate;
4066+
}
4067+
4068+
server cluster TlsClientManagement {
4069+
callback attribute maxProvisioned;
4070+
callback attribute provisionedEndpoints;
4071+
callback attribute generatedCommandList;
4072+
callback attribute acceptedCommandList;
4073+
callback attribute attributeList;
4074+
ram attribute featureMap default = 0;
4075+
callback attribute clusterRevision;
4076+
4077+
handle command ProvisionEndpoint;
4078+
handle command ProvisionEndpointResponse;
4079+
handle command FindEndpoint;
4080+
handle command FindEndpointResponse;
4081+
handle command RemoveEndpoint;
4082+
}
38564083
}
38574084

38584085

0 commit comments

Comments
 (0)