mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Swift Exception wrap HKDFKit
This commit is contained in:
parent
c4f8975308
commit
8544c86427
|
@ -101,7 +101,7 @@ NSErrorDomain const ContactDiscoveryServiceErrorDomain = @"SignalServiceKit.Cont
|
|||
NSData *_Nullable derivedMaterial;
|
||||
@try {
|
||||
derivedMaterial =
|
||||
[HKDFKit deriveKey:masterSecret info:nil salt:publicKeys outputSize:(int)kAES256_KeyByteLength * 2];
|
||||
[HKDFKit try_deriveKey:masterSecret info:nil salt:publicKeys outputSize:(int)kAES256_KeyByteLength * 2];
|
||||
} @catch (NSException *exception) {
|
||||
OWSFailDebug(@"could not derive service key: %@", exception);
|
||||
return NO;
|
||||
|
|
|
@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
NSData *infoData = [@"TextSecure Provisioning Message" dataUsingEncoding:NSASCIIStringEncoding];
|
||||
NSData *nullSalt = [[NSMutableData dataWithLength:32] copy];
|
||||
NSData *derivedSecret = [HKDFKit deriveKey:sharedSecret info:infoData salt:nullSalt outputSize:64];
|
||||
NSData *derivedSecret = [HKDFKit try_deriveKey:sharedSecret info:infoData salt:nullSalt outputSize:64];
|
||||
NSData *cipherKey = [derivedSecret subdataWithRange:NSMakeRange(0, 32)];
|
||||
NSData *macKey = [derivedSecret subdataWithRange:NSMakeRange(32, 32)];
|
||||
if (cipherKey.length != 32) {
|
||||
|
|
Loading…
Reference in a new issue