mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
ccb4a88742
git remote add ssk ../SignalServiceKit git remote update git merge -s ours --allow-unrelated-histories --no-commit ssk/master git read-tree --prefix=SignalServiceKit -u ssk/master git commit
23 lines
695 B
Objective-C
23 lines
695 B
Objective-C
//
|
|
// SecurityUtils.m
|
|
// TextSecureKit
|
|
//
|
|
// Created by Frederic Jacobs on 28/10/14.
|
|
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "SecurityUtils.h"
|
|
|
|
@implementation SecurityUtils
|
|
|
|
+ (NSData *)generateRandomBytes:(int)numberBytes {
|
|
NSMutableData *randomBytes = [NSMutableData dataWithLength:(NSUInteger)numberBytes];
|
|
int err = 0;
|
|
err = SecRandomCopyBytes(kSecRandomDefault, (size_t)numberBytes, [randomBytes mutableBytes]);
|
|
if (err != noErr) {
|
|
@throw [NSException exceptionWithName:@"random problem" reason:@"problem generating the random " userInfo:nil];
|
|
}
|
|
return randomBytes;
|
|
}
|
|
|
|
@end
|