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.
31 lines
757 B
Objective-C
31 lines
757 B
Objective-C
// Created by Frederic Jacobs on 21/12/14.
|
|
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
|
|
|
#import <XCTest/XCTest.h>
|
|
|
|
#import "TSAttachmentStream.h"
|
|
#import "Cryptography.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface TSAttachmentsTest : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation TSAttachmentsTest
|
|
|
|
- (void)testAttachmentEncryptionDecryption
|
|
{
|
|
NSData *plaintext = [Cryptography generateRandomBytes:100];
|
|
|
|
NSData *encryptionKey;
|
|
NSData *encryptedData = [Cryptography encryptAttachmentData:plaintext outKey:&encryptionKey];
|
|
NSData *plaintextBis = [Cryptography decryptAttachment:encryptedData withKey:encryptionKey];
|
|
|
|
XCTAssert([plaintext isEqualToData:plaintextBis], @"Attachments encryption failed");
|
|
}
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|