@@ -180,7 +180,7 @@ class DefaultDACVerifier : public DeviceAttestationVerifier
180
180
AttestationVerificationResult VerifyAttestationInformation (const ByteSpan & attestationInfoBuffer,
181
181
const ByteSpan & attestationChallengeBuffer,
182
182
const ByteSpan & attestationSignatureBuffer,
183
- const ByteSpan & paiCertDerBuffer , const ByteSpan & dacCertDerBuffer ,
183
+ const ByteSpan & paiDerBuffer , const ByteSpan & dacDerBuffer ,
184
184
const ByteSpan & attestationNonce) override ;
185
185
186
186
AttestationVerificationResult ValidateCertificationDeclarationSignature (const ByteSpan & cmsEnvelopeBuffer,
@@ -199,12 +199,12 @@ class DefaultDACVerifier : public DeviceAttestationVerifier
199
199
AttestationVerificationResult DefaultDACVerifier::VerifyAttestationInformation (const ByteSpan & attestationInfoBuffer,
200
200
const ByteSpan & attestationChallengeBuffer,
201
201
const ByteSpan & attestationSignatureBuffer,
202
- const ByteSpan & paiCertDerBuffer ,
203
- const ByteSpan & dacCertDerBuffer ,
202
+ const ByteSpan & paiDerBuffer ,
203
+ const ByteSpan & dacDerBuffer ,
204
204
const ByteSpan & attestationNonce)
205
205
{
206
206
VerifyOrReturnError (!attestationInfoBuffer.empty () && !attestationChallengeBuffer.empty () &&
207
- !attestationSignatureBuffer.empty () && !paiCertDerBuffer .empty () && !dacCertDerBuffer .empty () &&
207
+ !attestationSignatureBuffer.empty () && !paiDerBuffer .empty () && !dacDerBuffer .empty () &&
208
208
!attestationNonce.empty (),
209
209
AttestationVerificationResult::kInvalidArgument );
210
210
@@ -214,17 +214,17 @@ AttestationVerificationResult DefaultDACVerifier::VerifyAttestationInformation(c
214
214
uint16_t paiVid = VendorId::NotSpecified;
215
215
uint16_t dacVid = VendorId::NotSpecified;
216
216
217
- VerifyOrReturnError (ExtractDNAttributeFromX509Cert (MatterOid::kVendorId , paiCertDerBuffer , paiVid) == CHIP_NO_ERROR,
217
+ VerifyOrReturnError (ExtractDNAttributeFromX509Cert (MatterOid::kVendorId , paiDerBuffer , paiVid) == CHIP_NO_ERROR,
218
218
AttestationVerificationResult::kPaiFormatInvalid );
219
- VerifyOrReturnError (ExtractDNAttributeFromX509Cert (MatterOid::kVendorId , dacCertDerBuffer , dacVid) == CHIP_NO_ERROR,
219
+ VerifyOrReturnError (ExtractDNAttributeFromX509Cert (MatterOid::kVendorId , dacDerBuffer , dacVid) == CHIP_NO_ERROR,
220
220
AttestationVerificationResult::kDacFormatInvalid );
221
221
222
222
VerifyOrReturnError (paiVid == dacVid, AttestationVerificationResult::kDacVendorIdMismatch );
223
223
dacVendorId = static_cast <VendorId>(dacVid);
224
224
}
225
225
226
226
P256PublicKey remoteManufacturerPubkey;
227
- VerifyOrReturnError (ExtractPubkeyFromX509Cert (dacCertDerBuffer , remoteManufacturerPubkey) == CHIP_NO_ERROR,
227
+ VerifyOrReturnError (ExtractPubkeyFromX509Cert (dacDerBuffer , remoteManufacturerPubkey) == CHIP_NO_ERROR,
228
228
AttestationVerificationResult::kDacFormatInvalid );
229
229
230
230
// Validate overall attestation signature on attestation information
@@ -239,23 +239,33 @@ AttestationVerificationResult DefaultDACVerifier::VerifyAttestationInformation(c
239
239
240
240
uint8_t akidBuf[Crypto::kAuthorityKeyIdentifierLength ];
241
241
MutableByteSpan akid (akidBuf);
242
- ExtractAKIDFromX509Cert (paiCertDerBuffer , akid);
242
+ ExtractAKIDFromX509Cert (paiDerBuffer , akid);
243
243
244
244
constexpr size_t paaCertAllocatedLen = kMaxDERCertLength ;
245
245
chip::Platform::ScopedMemoryBuffer<uint8_t > paaCert;
246
246
VerifyOrReturnError (paaCert.Alloc (paaCertAllocatedLen), AttestationVerificationResult::kNoMemory );
247
- MutableByteSpan paa (paaCert.Get (), paaCertAllocatedLen);
248
- VerifyOrReturnError (mAttestationTrustStore ->GetProductAttestationAuthorityCert (akid, paa ) == CHIP_NO_ERROR,
247
+ MutableByteSpan paaDerBuffer (paaCert.Get (), paaCertAllocatedLen);
248
+ VerifyOrReturnError (mAttestationTrustStore ->GetProductAttestationAuthorityCert (akid, paaDerBuffer ) == CHIP_NO_ERROR,
249
249
AttestationVerificationResult::kPaaNotFound );
250
250
251
- VerifyOrReturnError (ValidateCertificateChain (paa.data (), paa.size (), paiCertDerBuffer.data (), paiCertDerBuffer.size (),
252
- dacCertDerBuffer.data (), dacCertDerBuffer.size ()) == CHIP_NO_ERROR,
251
+ #if !defined(CURRENT_TIME_NOT_IMPLEMENTED)
252
+ VerifyOrReturnError (IsCertificateValidAtCurrentTime (dacDerBuffer) == CHIP_NO_ERROR, AttestationVerificationResult::kDacExpired );
253
+ #endif
254
+
255
+ VerifyOrReturnError (IsCertificateValidAtIssuance (dacDerBuffer, paiDerBuffer) == CHIP_NO_ERROR,
256
+ AttestationVerificationResult::kPaiExpired );
257
+
258
+ VerifyOrReturnError (IsCertificateValidAtIssuance (dacDerBuffer, paaDerBuffer) == CHIP_NO_ERROR,
259
+ AttestationVerificationResult::kPaaExpired );
260
+
261
+ VerifyOrReturnError (ValidateCertificateChain (paaDerBuffer.data (), paaDerBuffer.size (), paiDerBuffer.data (), paiDerBuffer.size (),
262
+ dacDerBuffer.data (), dacDerBuffer.size ()) == CHIP_NO_ERROR,
253
263
AttestationVerificationResult::kDacSignatureInvalid );
254
264
255
265
// if PAA contains VID, see if matches with DAC's VID.
256
266
{
257
267
uint16_t paaVid = VendorId::NotSpecified;
258
- CHIP_ERROR error = ExtractDNAttributeFromX509Cert (MatterOid::kVendorId , paa , paaVid);
268
+ CHIP_ERROR error = ExtractDNAttributeFromX509Cert (MatterOid::kVendorId , paaDerBuffer , paaVid);
259
269
VerifyOrReturnError (error == CHIP_NO_ERROR || error == CHIP_ERROR_KEY_NOT_FOUND,
260
270
AttestationVerificationResult::kPaaFormatInvalid );
261
271
if (error != CHIP_ERROR_KEY_NOT_FOUND)
@@ -289,12 +299,12 @@ AttestationVerificationResult DefaultDACVerifier::VerifyAttestationInformation(c
289
299
.dacVendorId = dacVendorId,
290
300
.paiVendorId = dacVendorId,
291
301
};
292
- VerifyOrReturnError (ExtractDNAttributeFromX509Cert (MatterOid::kProductId , dacCertDerBuffer , deviceInfo.dacProductId ) ==
302
+ VerifyOrReturnError (ExtractDNAttributeFromX509Cert (MatterOid::kProductId , dacDerBuffer , deviceInfo.dacProductId ) ==
293
303
CHIP_NO_ERROR,
294
304
AttestationVerificationResult::kDacFormatInvalid );
295
305
// If PID is missing from PAI, the next method call will return CHIP_ERROR_KEY_NOT_FOUND.
296
306
// Valid return values are then CHIP_NO_ERROR or CHIP_ERROR_KEY_NOT_FOUND.
297
- CHIP_ERROR error = ExtractDNAttributeFromX509Cert (MatterOid::kProductId , paiCertDerBuffer , deviceInfo.paiProductId );
307
+ CHIP_ERROR error = ExtractDNAttributeFromX509Cert (MatterOid::kProductId , paiDerBuffer , deviceInfo.paiProductId );
298
308
VerifyOrReturnError (error == CHIP_NO_ERROR || error == CHIP_ERROR_KEY_NOT_FOUND,
299
309
AttestationVerificationResult::kPaiFormatInvalid );
300
310
return ValidateCertificateDeclarationPayload (certificationDeclarationPayload, firmwareInfoSpan, deviceInfo);
0 commit comments