mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
458 B
Matlab
20 lines
458 B
Matlab
|
9 years ago
|
//
|
||
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
|
//
|
||
|
|
|
||
|
12 years ago
|
#import "CryptoTools.h"
|
||
|
|
|
||
|
|
@implementation CryptoTools
|
||
|
|
|
||
|
8 years ago
|
+ (NSData *)generateSecureRandomData:(NSUInteger)length
|
||
|
|
{
|
||
|
10 years ago
|
NSMutableData *d = [NSMutableData dataWithLength:length];
|
||
|
8 years ago
|
OSStatus status = SecRandomCopyBytes(kSecRandomDefault, length, [d mutableBytes]);
|
||
|
9 years ago
|
if (status != noErr) {
|
||
|
10 years ago
|
[SecurityFailure raise:@"SecRandomCopyBytes failed"];
|
||
|
|
}
|
||
|
9 years ago
|
return [d copy];
|
||
|
12 years ago
|
}
|
||
|
|
|
||
|
|
@end
|