diff --git a/MatrixSDK/Crypto/SecretStorage/MXSecretStorage.m b/MatrixSDK/Crypto/SecretStorage/MXSecretStorage.m index 014c15215..69b2124d0 100644 --- a/MatrixSDK/Crypto/SecretStorage/MXSecretStorage.m +++ b/MatrixSDK/Crypto/SecretStorage/MXSecretStorage.m @@ -169,10 +169,13 @@ - (MXHTTPOperation*)createKeyWithKeyId:(nullable NSString*)keyId { uint8_t randomBytes[32]; OSStatus status = SecRandomCopyBytes(kSecRandomDefault, sizeof(randomBytes), randomBytes); - - if (status == errSecSuccess) { + + if (status == errSecSuccess) + { privateKey = [NSData dataWithBytes:randomBytes length:sizeof(randomBytes)]; - } else { + } + else + { MXLogDebug(@"Failed to generate random bytes with error: %d", (int)status); } }