Expose HMAC digestLength where available
This commit is contained in:
parent
9103192513
commit
401d999b3d
@ -97,6 +97,11 @@ const NSInteger CryptoAEADTagLength = 16;
|
||||
self.cipher = NULL;
|
||||
}
|
||||
|
||||
- (int)digestLength
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma mark Encrypter
|
||||
|
||||
- (void)configureEncryptionWithCipherKey:(ZeroingData *)cipherKey hmacKey:(ZeroingData *)hmacKey
|
||||
|
@ -68,4 +68,6 @@
|
||||
- (nonnull id<Encrypter>)encrypter;
|
||||
- (nonnull id<Decrypter>)decrypter;
|
||||
|
||||
- (NSInteger)digestLength;
|
||||
|
||||
@end
|
||||
|
@ -50,6 +50,7 @@
|
||||
|
||||
@property (nonatomic, strong) NSString *cipherAlgorithm;
|
||||
@property (nonatomic, strong) NSString *digestAlgorithm;
|
||||
@property (nonatomic, assign) NSInteger digestLength;
|
||||
|
||||
@property (nonatomic, strong) id<Encrypter> encrypter;
|
||||
@property (nonatomic, strong) id<Decrypter> decrypter;
|
||||
@ -131,6 +132,9 @@
|
||||
[self.encrypter configureEncryptionWithCipherKey:cipherEncKey hmacKey:hmacEncKey];
|
||||
[self.decrypter configureDecryptionWithCipherKey:cipherDecKey hmacKey:hmacDecKey];
|
||||
|
||||
NSAssert(self.encrypter.digestLength == self.decrypter.digestLength, @"Digest length mismatch in encrypter/decrypter");
|
||||
self.digestLength = self.encrypter.digestLength;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
@protocol Encrypter
|
||||
|
||||
- (void)configureEncryptionWithCipherKey:(nonnull ZeroingData *)cipherKey hmacKey:(nonnull ZeroingData *)hmacKey;
|
||||
- (int)digestLength;
|
||||
- (int)overheadLength;
|
||||
- (int)extraLength;
|
||||
|
||||
@ -59,6 +60,7 @@
|
||||
@protocol Decrypter
|
||||
|
||||
- (void)configureDecryptionWithCipherKey:(nonnull ZeroingData *)cipherKey hmacKey:(nonnull ZeroingData *)hmacKey;
|
||||
- (int)digestLength;
|
||||
- (int)overheadLength;
|
||||
- (int)extraLength;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user