From b8a6d576e19828ffddf6c8e3c3353efd03836b2e Mon Sep 17 00:00:00 2001 From: smizrahi Date: Tue, 27 Feb 2024 13:46:06 +0100 Subject: [PATCH] fix(core): Improve error logging on url encryption --- SoObjects/SOGo/NSString+Crypto.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SoObjects/SOGo/NSString+Crypto.m b/SoObjects/SOGo/NSString+Crypto.m index c5777db24..eff0d23f8 100644 --- a/SoObjects/SOGo/NSString+Crypto.m +++ b/SoObjects/SOGo/NSString+Crypto.m @@ -385,7 +385,7 @@ static const NSString *kAES256GCMError = @"kAES256GCMError"; value = nil; if (AES_128_KEY_SIZE != [passwordScheme length]) { - *ex = [NSException exceptionWithName: kAES128ECError reason: [NSString stringWithFormat:@"Key must be %d bits", (AES_128_KEY_SIZE * 8)] userInfo: nil]; + *ex = [NSException exceptionWithName: kAES128ECError reason: [NSString stringWithFormat:@"Key must be %d bits, but key has %d bits", (AES_128_KEY_SIZE * 8), ([passwordScheme length] * 8)] userInfo: nil]; return nil; } @@ -457,7 +457,7 @@ static const NSString *kAES256GCMError = @"kAES256GCMError"; #ifdef HAVE_OPENSSL if (AES_128_KEY_SIZE != [passwordScheme length]) { - *ex = [NSException exceptionWithName: kAES128ECError reason: [NSString stringWithFormat:@"Key must be %d bits", (AES_128_KEY_SIZE * 8)] userInfo: nil]; + *ex = [NSException exceptionWithName: kAES128ECError reason: [NSString stringWithFormat:@"Key must be %d bits, but key has %d bits", (AES_128_KEY_SIZE * 8), ([passwordScheme length] * 8)] userInfo: nil]; return nil; } keyData = [passwordScheme dataUsingEncoding: NSUTF8StringEncoding];