@@ -127,13 +127,9 @@ - (void)testGenerateIntermediateCert
127
127
__auto_type * intermediateKeys = [[MTRTestKeys alloc ] init ];
128
128
XCTAssertNotNil (intermediateKeys);
129
129
130
- __auto_type * intermediatePublicKey = [intermediateKeys copyPublicKey ];
131
- XCTAssert (intermediatePublicKey != NULL );
132
- CFAutorelease (intermediatePublicKey);
133
-
134
130
__auto_type * intermediateCert = [MTRCertificates createIntermediateCertificate: rootKeys
135
131
rootCertificate: rootCert
136
- intermediatePublicKey: intermediatePublicKey
132
+ intermediatePublicKey: intermediateKeys.publicKey
137
133
issuerID: nil
138
134
fabricID: nil
139
135
error: nil ];
@@ -159,16 +155,13 @@ - (void)testGenerateIntermediateCertWithValidityPeriod
159
155
160
156
__auto_type * intermediateKeys = [[MTRTestKeys alloc ] init ];
161
157
XCTAssertNotNil (intermediateKeys);
162
- __auto_type * intermediatePublicKey = intermediateKeys.copyPublicKey ;
163
- XCTAssert (intermediatePublicKey != NULL );
164
- CFAutorelease (intermediatePublicKey);
165
158
166
159
__auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow: 300 ];
167
160
__auto_type * validityPeriod = [[NSDateInterval alloc ] initWithStartDate: startDate duration: 400 ];
168
161
169
162
__auto_type * intermediateCert = [MTRCertificates createIntermediateCertificate: rootKeys
170
163
rootCertificate: rootCert
171
- intermediatePublicKey: intermediatePublicKey
164
+ intermediatePublicKey: intermediateKeys.publicKey
172
165
issuerID: nil
173
166
fabricID: nil
174
167
validityPeriod: validityPeriod
@@ -199,16 +192,13 @@ - (void)testGenerateIntermediateCertWithInfiniteValidity
199
192
200
193
__auto_type * intermediateKeys = [[MTRTestKeys alloc ] init ];
201
194
XCTAssertNotNil (intermediateKeys);
202
- __auto_type * intermediatePublicKey = intermediateKeys.copyPublicKey ;
203
- XCTAssert (intermediatePublicKey != NULL );
204
- CFAutorelease (intermediatePublicKey);
205
195
206
196
__auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow: 300 ];
207
197
__auto_type * validityPeriod = [[NSDateInterval alloc ] initWithStartDate: startDate endDate: [NSDate distantFuture ]];
208
198
209
199
__auto_type * intermediateCert = [MTRCertificates createIntermediateCertificate: rootKeys
210
200
rootCertificate: rootCert
211
- intermediatePublicKey: intermediatePublicKey
201
+ intermediatePublicKey: intermediateKeys.publicKey
212
202
issuerID: nil
213
203
fabricID: nil
214
204
validityPeriod: validityPeriod
@@ -239,9 +229,6 @@ - (void)testGenerateOperationalCertNoIntermediate
239
229
240
230
__auto_type * operationalKeys = [[MTRTestKeys alloc ] init ];
241
231
XCTAssertNotNil (operationalKeys);
242
- __auto_type * operationalPublicKey = [operationalKeys copyPublicKey ];
243
- XCTAssert (operationalPublicKey != NULL );
244
- CFAutorelease (operationalPublicKey);
245
232
246
233
__auto_type * cats = [[NSMutableSet alloc ] initWithCapacity: 3 ];
247
234
// High bits are identifier, low bits are version.
@@ -251,7 +238,7 @@ - (void)testGenerateOperationalCertNoIntermediate
251
238
252
239
__auto_type * operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
253
240
signingCertificate: rootCert
254
- operationalPublicKey: operationalPublicKey
241
+ operationalPublicKey: operationalKeys.publicKey
255
242
fabricID: @1
256
243
nodeID: @1
257
244
caseAuthenticatedTags: cats
@@ -278,9 +265,6 @@ - (void)testGenerateOperationalCertNoIntermediateWithValidityPeriod
278
265
279
266
__auto_type * operationalKeys = [[MTRTestKeys alloc ] init ];
280
267
XCTAssertNotNil (operationalKeys);
281
- __auto_type * operationalPublicKey = [operationalKeys copyPublicKey ];
282
- XCTAssert (operationalPublicKey != NULL );
283
- CFAutorelease (operationalPublicKey);
284
268
285
269
__auto_type * cats = [[NSMutableSet alloc ] initWithCapacity: 3 ];
286
270
// High bits are identifier, low bits are version.
@@ -293,7 +277,7 @@ - (void)testGenerateOperationalCertNoIntermediateWithValidityPeriod
293
277
294
278
__auto_type * operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
295
279
signingCertificate: rootCert
296
- operationalPublicKey: operationalPublicKey
280
+ operationalPublicKey: operationalKeys.publicKey
297
281
fabricID: @1
298
282
nodeID: @1
299
283
caseAuthenticatedTags: cats
@@ -325,9 +309,6 @@ - (void)testGenerateOperationalCertNoIntermediateWithInfiniteValidity
325
309
326
310
__auto_type * operationalKeys = [[MTRTestKeys alloc ] init ];
327
311
XCTAssertNotNil (operationalKeys);
328
- __auto_type * operationalPublicKey = [operationalKeys copyPublicKey ];
329
- XCTAssert (operationalPublicKey != NULL );
330
- CFAutorelease (operationalPublicKey);
331
312
332
313
__auto_type * cats = [[NSMutableSet alloc ] initWithCapacity: 3 ];
333
314
// High bits are identifier, low bits are version.
@@ -340,7 +321,7 @@ - (void)testGenerateOperationalCertNoIntermediateWithInfiniteValidity
340
321
341
322
__auto_type * operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
342
323
signingCertificate: rootCert
343
- operationalPublicKey: operationalPublicKey
324
+ operationalPublicKey: operationalKeys.publicKey
344
325
fabricID: @1
345
326
nodeID: @1
346
327
caseAuthenticatedTags: cats
@@ -372,27 +353,21 @@ - (void)testGenerateOperationalCertWithIntermediate
372
353
373
354
__auto_type * intermediateKeys = [[MTRTestKeys alloc ] init ];
374
355
XCTAssertNotNil (intermediateKeys);
375
- __auto_type * intermediatePublicKey = [intermediateKeys copyPublicKey ];
376
- XCTAssert (intermediatePublicKey != NULL );
377
- CFAutorelease (intermediatePublicKey);
378
356
379
357
__auto_type * intermediateCert = [MTRCertificates createIntermediateCertificate: rootKeys
380
358
rootCertificate: rootCert
381
- intermediatePublicKey: intermediatePublicKey
359
+ intermediatePublicKey: intermediateKeys.publicKey
382
360
issuerID: nil
383
361
fabricID: nil
384
362
error: nil ];
385
363
XCTAssertNotNil (intermediateCert);
386
364
387
365
__auto_type * operationalKeys = [[MTRTestKeys alloc ] init ];
388
366
XCTAssertNotNil (operationalKeys);
389
- __auto_type * operationalPublicKey = [operationalKeys copyPublicKey ];
390
- XCTAssert (operationalPublicKey != NULL );
391
- CFAutorelease (operationalPublicKey);
392
367
393
368
__auto_type * operationalCert = [MTRCertificates createOperationalCertificate: intermediateKeys
394
369
signingCertificate: intermediateCert
395
- operationalPublicKey: operationalPublicKey
370
+ operationalPublicKey: operationalKeys.publicKey
396
371
fabricID: @1
397
372
nodeID: @1
398
373
caseAuthenticatedTags: nil
@@ -419,9 +394,6 @@ - (void)testGenerateOperationalCertErrorCases
419
394
420
395
__auto_type * operationalKeys = [[MTRTestKeys alloc ] init ];
421
396
XCTAssertNotNil (operationalKeys);
422
- __auto_type * operationalPublicKey = [operationalKeys copyPublicKey ];
423
- XCTAssert (operationalPublicKey != NULL );
424
- CFAutorelease (operationalPublicKey);
425
397
426
398
__auto_type * longCats = [[NSMutableSet alloc ] initWithCapacity: 4 ];
427
399
[longCats addObject: @0x00010001 ];
@@ -443,7 +415,7 @@ - (void)testGenerateOperationalCertErrorCases
443
415
// Check basic case works
444
416
__auto_type * operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
445
417
signingCertificate: rootCert
446
- operationalPublicKey: operationalPublicKey
418
+ operationalPublicKey: operationalKeys.publicKey
447
419
fabricID: @1
448
420
nodeID: @1
449
421
caseAuthenticatedTags: nil
@@ -453,7 +425,7 @@ - (void)testGenerateOperationalCertErrorCases
453
425
// CATs too long
454
426
operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
455
427
signingCertificate: rootCert
456
- operationalPublicKey: operationalPublicKey
428
+ operationalPublicKey: operationalKeys.publicKey
457
429
fabricID: @1
458
430
nodeID: @1
459
431
caseAuthenticatedTags: longCats
@@ -463,7 +435,7 @@ - (void)testGenerateOperationalCertErrorCases
463
435
// Multiple CATs with the same identifier but different versions
464
436
operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
465
437
signingCertificate: rootCert
466
- operationalPublicKey: operationalPublicKey
438
+ operationalPublicKey: operationalKeys.publicKey
467
439
fabricID: @1
468
440
nodeID: @1
469
441
caseAuthenticatedTags: catsWithSameIdentifier
@@ -473,7 +445,7 @@ - (void)testGenerateOperationalCertErrorCases
473
445
// CAT with invalid version
474
446
operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
475
447
signingCertificate: rootCert
476
- operationalPublicKey: operationalPublicKey
448
+ operationalPublicKey: operationalKeys.publicKey
477
449
fabricID: @1
478
450
nodeID: @1
479
451
caseAuthenticatedTags: catsWithInvalidVersion
@@ -483,7 +455,7 @@ - (void)testGenerateOperationalCertErrorCases
483
455
// Signing key mismatch
484
456
operationalCert = [MTRCertificates createOperationalCertificate: operationalKeys
485
457
signingCertificate: rootCert
486
- operationalPublicKey: operationalPublicKey
458
+ operationalPublicKey: operationalKeys.publicKey
487
459
fabricID: @1
488
460
nodeID: @1
489
461
caseAuthenticatedTags: nil
@@ -493,7 +465,7 @@ - (void)testGenerateOperationalCertErrorCases
493
465
// Invalid fabric id
494
466
operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
495
467
signingCertificate: rootCert
496
- operationalPublicKey: operationalPublicKey
468
+ operationalPublicKey: operationalKeys.publicKey
497
469
fabricID: @0
498
470
nodeID: @1
499
471
caseAuthenticatedTags: nil
@@ -503,7 +475,7 @@ - (void)testGenerateOperationalCertErrorCases
503
475
// Undefined node id
504
476
operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
505
477
signingCertificate: rootCert
506
- operationalPublicKey: operationalPublicKey
478
+ operationalPublicKey: operationalKeys.publicKey
507
479
fabricID: @1
508
480
nodeID: @0
509
481
caseAuthenticatedTags: nil
@@ -513,7 +485,7 @@ - (void)testGenerateOperationalCertErrorCases
513
485
// Non-operational node id
514
486
operationalCert = [MTRCertificates createOperationalCertificate: rootKeys
515
487
signingCertificate: rootCert
516
- operationalPublicKey: operationalPublicKey
488
+ operationalPublicKey: operationalKeys.publicKey
517
489
fabricID: @1
518
490
nodeID: @(0xFFFFFFFFFFFFFFFFLLU)
519
491
caseAuthenticatedTags: nil
0 commit comments