File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
MatrixSDK/Crypto/SecretStorage Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2525#import " MXBase64Tools.h"
2626#import " MXEncryptedSecretContent.h"
2727
28+ #import < Security/Security.h>
2829
2930#pragma mark - Constants
3031
@@ -166,9 +167,14 @@ - (MXHTTPOperation*)createKeyWithKeyId:(nullable NSString*)keyId
166167 }
167168 else
168169 {
169- OLMPkDecryption *decryption = [OLMPkDecryption new ];
170- [decryption generateKey: &error];
171- privateKey = decryption.privateKey ;
170+ uint8_t randomBytes[32 ];
171+ OSStatus status = SecRandomCopyBytes (kSecRandomDefault , sizeof (randomBytes), randomBytes);
172+
173+ if (status == errSecSuccess) {
174+ privateKey = [NSData dataWithBytes: randomBytes length: sizeof (randomBytes)];
175+ } else {
176+ MXLogDebug (@" Failed to generate random bytes with error: %d " , (int )status);
177+ }
172178 }
173179
174180 if (error)
You can’t perform that action at this time.
0 commit comments