2018-03-16 15:55:16 +01:00
|
|
|
//
|
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
@interface OWSBackupEncryptedItem : NSObject
|
|
|
|
|
|
|
|
@property (nonatomic) NSString *filePath;
|
|
|
|
|
|
|
|
@property (nonatomic) NSData *encryptionKey;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
@interface OWSBackupEncryption : NSObject
|
|
|
|
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
|
|
|
|
- (instancetype)initWithJobTempDirPath:(NSString *)jobTempDirPath;
|
|
|
|
|
|
|
|
#pragma mark - Encrypt
|
|
|
|
|
|
|
|
- (nullable OWSBackupEncryptedItem *)encryptFileAsTempFile:(NSString *)srcFilePath;
|
|
|
|
|
|
|
|
- (nullable OWSBackupEncryptedItem *)encryptFileAsTempFile:(NSString *)srcFilePath
|
|
|
|
encryptionKey:(NSData *)encryptionKey;
|
|
|
|
|
|
|
|
- (nullable OWSBackupEncryptedItem *)encryptDataAsTempFile:(NSData *)srcData;
|
|
|
|
|
|
|
|
- (nullable OWSBackupEncryptedItem *)encryptDataAsTempFile:(NSData *)srcData encryptionKey:(NSData *)encryptionKey;
|
|
|
|
|
|
|
|
#pragma mark - Decrypt
|
|
|
|
|
2018-03-16 17:55:20 +01:00
|
|
|
- (BOOL)decryptFileAsFile:(NSString *)srcFilePath
|
|
|
|
dstFilePath:(NSString *)dstFilePath
|
|
|
|
encryptionKey:(NSData *)encryptionKey;
|
|
|
|
|
|
|
|
- (nullable NSData *)decryptFileAsData:(NSString *)srcFilePath encryptionKey:(NSData *)encryptionKey;
|
2018-03-16 15:55:16 +01:00
|
|
|
|
|
|
|
- (nullable NSData *)decryptDataAsData:(NSData *)srcData encryptionKey:(NSData *)encryptionKey;
|
|
|
|
|
2018-03-16 17:55:20 +01:00
|
|
|
#pragma mark - Compression
|
|
|
|
|
|
|
|
- (nullable NSData *)compressData:(NSData *)srcData;
|
|
|
|
|
|
|
|
- (nullable NSData *)decompressData:(NSData *)srcData uncompressedDataLength:(NSUInteger)uncompressedDataLength;
|
|
|
|
|
2018-03-16 15:55:16 +01:00
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|