blob: 5dbe644e888d59485d2733fd11218b2c27f6168a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//
// OLMUtility.m
// olm
//
// Created by Chris Ballinger on 4/8/16.
//
//
#import "OLMUtility.h"
@implementation OLMUtility
+ (NSMutableData*) randomBytesOfLength:(NSUInteger)length {
NSMutableData *randomData = [NSMutableData dataWithLength:length];
if (!randomData) {
return nil;
}
int result = SecRandomCopyBytes(kSecRandomDefault, randomData.length, randomData.mutableBytes);
if (result != 0) {
return nil;
}
return randomData;
}
@end
|