Skip to content

Commit 3511670

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Add a signature count to MTRTestKeys. (#28452)
This lets us check whether CASE resumption is happening.
1 parent a5ec920 commit 3511670

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/darwin/Framework/CHIPTests/TestHelpers/MTRTestKeys.h

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
2525

2626
@property (readonly, nonatomic) NSData * publicKeyData;
2727

28+
// Count of how many times this keypair has been used to signMessageECDSA_DER.
29+
@property (readonly, nonatomic, assign) unsigned signatureCount;
30+
2831
- (instancetype)init;
2932

3033
@end

src/darwin/Framework/CHIPTests/TestHelpers/MTRTestKeys.m

+4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ - (instancetype)init
6969
}
7070
_publicKey = SecKeyCopyPublicKey(_privateKey);
7171

72+
_signatureCount = 0;
73+
7274
return self;
7375
}
7476

7577
- (NSData *)signMessageECDSA_DER:(NSData *)message
7678
{
79+
++_signatureCount;
80+
7781
CFErrorRef error = NULL;
7882
CFDataRef outData
7983
= SecKeyCreateSignature(_privateKey, kSecKeyAlgorithmECDSASignatureMessageX962SHA256, (__bridge CFDataRef) message, &error);

0 commit comments

Comments
 (0)