Fix ECKeyPair usage

This commit is contained in:
nielsandriesse 2020-11-12 10:41:45 +11:00
parent 5d8d468826
commit 1c0b32af3c
163 changed files with 261 additions and 3419 deletions

21
Podfile
View File

@ -24,27 +24,29 @@ end
target 'SessionShareExtension' do
pod 'AFNetworking', inhibit_warnings: true
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'Mantle', git: 'https://github.com/signalapp/Mantle', branch: 'signal-master', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'PureLayout', '~> 3.1.4', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
pod 'YapDatabase/SQLCipher', :git => 'https://github.com/signalapp/YapDatabase.git', branch: 'signal-release', :inhibit_warnings => true
end
target 'SessionPushNotificationExtension' do
pod 'AFNetworking', inhibit_warnings: true
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'Mantle', git: 'https://github.com/signalapp/Mantle', branch: 'signal-master', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'PureLayout', '~> 3.1.4', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
pod 'YapDatabase/SQLCipher', :git => 'https://github.com/signalapp/YapDatabase.git', branch: 'signal-release', :inhibit_warnings => true
end
target 'SignalUtilitiesKit' do
pod 'AFNetworking', inhibit_warnings: true
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'GRKOpenSSLFramework', :inhibit_warnings => true
pod 'HKDFKit', :inhibit_warnings => true
pod 'libPhoneNumber-iOS', :inhibit_warnings => true
@ -53,6 +55,7 @@ target 'SignalUtilitiesKit' do
pod 'PureLayout', '~> 3.1.4', :inhibit_warnings => true
pod 'Reachability', :inhibit_warnings => true
pod 'SAMKeychain', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
pod 'Starscream', git: 'https://github.com/signalapp/Starscream.git', branch: 'signal-release', :inhibit_warnings => true
pod 'SwiftProtobuf', '~> 1.5.0', :inhibit_warnings => true
pod 'YapDatabase/SQLCipher', :git => 'https://github.com/signalapp/YapDatabase.git', branch: 'signal-release', :inhibit_warnings => true
@ -66,31 +69,35 @@ end
target 'SessionMessagingKit' do
pod 'AFNetworking', inhibit_warnings: true
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
pod 'SwiftProtobuf', '~> 1.5.0', :inhibit_warnings => true
end
target 'SessionProtocolKit' do
pod 'CocoaLumberjack', :inhibit_warnings => true
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'GRKOpenSSLFramework', :inhibit_warnings => true
pod 'HKDFKit', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
pod 'SwiftProtobuf', '~> 1.5.0', :inhibit_warnings => true
end
target 'SessionSnodeKit' do
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
end
target 'SessionUtilitiesKit' do
pod 'CryptoSwift', :inhibit_warnings => true
pod 'Curve25519Kit', :inhibit_warnings => true
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
end
post_install do |installer|

View File

@ -18,7 +18,9 @@ PODS:
- CocoaLumberjack/Core (= 3.6.2)
- CocoaLumberjack/Core (3.6.2)
- CryptoSwift (1.3.2)
- Curve25519Kit (2.1.0)
- Curve25519Kit (2.1.0):
- CocoaLumberjack
- SignalCoreKit
- FeedKit (8.1.1)
- GRKOpenSSLFramework (1.0.2.20)
- HKDFKit (0.0.3)
@ -41,6 +43,9 @@ PODS:
- PureLayout (3.1.6)
- Reachability (3.2)
- SAMKeychain (1.5.3)
- SignalCoreKit (1.0.0):
- CocoaLumberjack
- GRKOpenSSLFramework
- Sodium (0.8.0)
- SQLCipher (4.4.0):
- SQLCipher/standard (= 4.4.0)
@ -123,7 +128,7 @@ DEPENDENCIES:
- AFNetworking
- CocoaLumberjack
- CryptoSwift
- Curve25519Kit
- Curve25519Kit (from `https://github.com/signalapp/Curve25519Kit.git`)
- FeedKit
- GRKOpenSSLFramework
- HKDFKit
@ -134,6 +139,7 @@ DEPENDENCIES:
- PureLayout (~> 3.1.4)
- Reachability
- SAMKeychain
- SignalCoreKit (from `https://github.com/signalapp/SignalCoreKit.git`)
- Sodium
- SSZipArchive
- Starscream (from `https://github.com/signalapp/Starscream.git`, branch `signal-release`)
@ -147,7 +153,6 @@ SPEC REPOS:
- AFNetworking
- CocoaLumberjack
- CryptoSwift
- Curve25519Kit
- FeedKit
- GRKOpenSSLFramework
- HKDFKit
@ -164,9 +169,13 @@ SPEC REPOS:
- ZXingObjC
EXTERNAL SOURCES:
Curve25519Kit:
:git: https://github.com/signalapp/Curve25519Kit.git
Mantle:
:branch: signal-master
:git: https://github.com/signalapp/Mantle
SignalCoreKit:
:git: https://github.com/signalapp/SignalCoreKit.git
Starscream:
:branch: signal-release
:git: https://github.com/signalapp/Starscream.git
@ -177,9 +186,15 @@ EXTERNAL SOURCES:
:git: https://github.com/signalapp/YYImage
CHECKOUT OPTIONS:
Curve25519Kit:
:commit: 4fc1c10e98fff2534b5379a9bb587430fdb8e577
:git: https://github.com/signalapp/Curve25519Kit.git
Mantle:
:commit: b72c2d1e6132501db906de2cffa8ded7803c54f4
:git: https://github.com/signalapp/Mantle
SignalCoreKit:
:commit: 21c092e94b307690957b50f2305e5e65d28fa89e
:git: https://github.com/signalapp/SignalCoreKit.git
Starscream:
:commit: b09ea163c3cb305152c65b299cb024610f52e735
:git: https://github.com/signalapp/Starscream.git
@ -194,7 +209,7 @@ SPEC CHECKSUMS:
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
CocoaLumberjack: bd155f2dd06c0e0b03f876f7a3ee55693122ec94
CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060
Curve25519Kit: 76d0859ecb34704f7732847812363f83b23a6a59
Curve25519Kit: e63f9859ede02438ae3defc5e1a87e09d1ec7ee6
FeedKit: 3418eed25f0b493b205b4de1b8511ac21d413fa9
GRKOpenSSLFramework: dc635b0a9d4cd8af2a9ff80a61e779e21b69dfd8
HKDFKit: c058305d6f64b84f28c50bd7aa89574625bcb62a
@ -205,6 +220,7 @@ SPEC CHECKSUMS:
PureLayout: bd3c4ec3a3819ad387c99ebb72c6b129c3ed4d2d
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
SignalCoreKit: 4562b2bbd9830077439ca003f952a798457d4ea5
Sodium: 63c0ca312a932e6da481689537d4b35568841bdc
SQLCipher: e434ed542b24f38ea7b36468a13f9765e1b5c072
SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9
@ -214,6 +230,6 @@ SPEC CHECKSUMS:
YYImage: 6db68da66f20d9f169ceb94dfb9947c3867b9665
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
PODFILE CHECKSUM: db9bd6df7d17f8926d13475263d89cd767f7eea2
PODFILE CHECKSUM: 1aad5fbd49d168d2f50da0b3b3e515247f1ce291
COCOAPODS: 1.10.0.rc.1

View File

@ -4,7 +4,7 @@ import SessionSnodeKit
@objc(SNConfiguration)
final class Configuration : NSObject {
@objc func performMainSetup() {
@objc static func performMainSetup() {
SessionProtocolKit.configure(storage: Storage.shared, sharedSenderKeysDelegate: UIApplication.shared.delegate as! AppDelegate)
SessionSnodeKit.configure(storage: Storage.shared)
}

View File

@ -45,12 +45,12 @@
#import <SessionProtocolKit/NSData+keyVersionByte.h>
#import <PureLayout/PureLayout.h>
#import <Reachability/Reachability.h>
#import <SessionProtocolKit/Cryptography.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SessionProtocolKit/OWSLogs.h>
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/Cryptography.h>
#import <SignalCoreKit/NSData+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalCoreKit/OWSLogs.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SignalUtilitiesKit/ContactTableViewCell.h>
#import <SignalUtilitiesKit/Environment.h>

View File

@ -15,8 +15,8 @@
static const NSUInteger ddLogLevel = DDLogLevelInfo;
#endif
#import <SessionProtocolKit/NSObject+OWS.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/NSObject+OWS.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalUtilitiesKit/SSKAsserts.h>
#import <SignalUtilitiesKit/OWSAnalytics.h>
#import <SignalUtilitiesKit/NSArray+Functional.h>

View File

@ -14,7 +14,7 @@
#import "SignalsNavigationController.h"
#import "ViewControllerUtils.h"
#import <PromiseKit/AnyPromise.h>
#import <SessionProtocolKit/iOSVersions.h>
#import <SignalCoreKit/iOSVersions.h>
#import <SignalUtilitiesKit/AppSetup.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>
@ -240,6 +240,8 @@ static NSTimeInterval launchStartedAt;
[self versionMigrationsDidComplete];
}];
[SNConfiguration performMainSetup];
[LKAppearanceUtilities switchToSessionAppearance];
if (CurrentAppContext().isRunningTests) {

View File

@ -13,6 +13,7 @@
#import <SignalUtilitiesKit/MimeTypeUtil.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SignalUtilitiesKit/TSAttachmentStream.h>
#import <SignalCoreKit/NSString+OWS.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -8,7 +8,7 @@
#import "UIColor+OWS.h"
#import "UIView+OWS.h"
#import <QuartzCore/QuartzCore.h>
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/NSTimer+OWS.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -7,6 +7,7 @@
#import "Environment.h"
#import "OWSBubbleView.h"
#import "Session-Swift.h"
#import <SignalCoreKit/NSString+OWS.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>

View File

@ -5,6 +5,7 @@
#import "ConversationInputTextView.h"
#import "Session-Swift.h"
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SignalCoreKit/NSString+OWS.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -26,6 +26,7 @@
#import "OWSMath.h"
#import "OWSMessageCell.h"
#import "OWSSystemMessageCell.h"
#import <SignalCoreKit/NSString+OWS.h>
#import "Session-Swift.h"
#import <SignalUtilitiesKit/SignalKeyingStorage.h>
#import "TSAttachmentPointer.h"
@ -45,8 +46,8 @@
#import <ContactsUI/CNContactViewController.h>
#import <MobileCoreServices/UTCoreTypes.h>
#import <PromiseKit/AnyPromise.h>
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSContactOffersInteraction.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>

View File

@ -8,7 +8,7 @@
#import "OWSMessageBubbleView.h"
#import "OWSQuotedReplyModel.h"
#import "Session-Swift.h"
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/OWSContactOffersInteraction.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>
#import <SignalUtilitiesKit/OWSUnreadIndicator.h>

View File

@ -3,7 +3,7 @@
//
#import "DateUtil.h"
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/OWSFormat.h>
#import <SignalUtilitiesKit/NSString+SSK.h>

View File

@ -9,7 +9,7 @@
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>
#import <SignalUtilitiesKit/UIUtil.h>

View File

@ -4,7 +4,7 @@
#import "MainAppContext.h"
#import "Session-Swift.h"
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>

View File

@ -8,7 +8,7 @@
#import "OWSBackupImportJob.h"
#import "Session-Swift.h"
#import <PromiseKit/AnyPromise.h>
#import <Curve25519Kit/Randomness.h>
#import <SignalCoreKit/Randomness.h>
#import <SignalUtilitiesKit/OWSIdentityManager.h>
#import <SignalUtilitiesKit/YapDatabaseConnection+OWS.h>

View File

@ -7,9 +7,9 @@
#import "OWSDatabaseMigration.h"
#import "Session-Swift.h"
#import <PromiseKit/AnyPromise.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/NSData+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/OWSBackgroundTask.h>
#import <SignalUtilitiesKit/OWSError.h>
#import <SignalUtilitiesKit/OWSFileSystem.h>

View File

@ -3,7 +3,7 @@
//
#import "OWSBackupIO.h"
#import <Curve25519Kit/Randomness.h>
#import <SignalCoreKit/Randomness.h>
#import <SignalUtilitiesKit/OWSFileSystem.h>
@import Compression;

View File

@ -8,7 +8,7 @@
#import "OWSDatabaseMigrationRunner.h"
#import "Session-Swift.h"
#import <PromiseKit/AnyPromise.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SignalCoreKit/NSData+OWS.h>
#import <SignalUtilitiesKit/OWSBackgroundTask.h>
#import <SignalUtilitiesKit/OWSFileSystem.h>
#import <SignalUtilitiesKit/TSAttachment.h>

View File

@ -6,7 +6,7 @@
#import "OWSBackupIO.h"
#import "Session-Swift.h"
#import <PromiseKit/AnyPromise.h>
#import <Curve25519Kit/Randomness.h>
#import <SignalCoreKit/Randomness.h>
#import <YapDatabase/YapDatabaseCryptoUtils.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -16,7 +16,7 @@
#import "UIView+OWS.h"
#import "UpdateGroupViewController.h"
#import <Curve25519Kit/Curve25519.h>
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSAvatarBuilder.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>

View File

@ -4,7 +4,7 @@
#import "OWSDeviceProvisioningURLParser.h"
#import <SessionProtocolKit/NSData+keyVersionByte.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SignalCoreKit/NSData+OWS.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -4,7 +4,7 @@
#import "OWSOrphanDataCleaner.h"
#import "DateUtil.h"
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SignalUtilitiesKit/OWSUserProfile.h>
#import <SignalUtilitiesKit/AppReadiness.h>

View File

@ -8,7 +8,7 @@
#import "zlib.h"
#import <AFNetworking/AFNetworking.h>
#import <SSZipArchive/SSZipArchive.h>
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SignalUtilitiesKit/DebugLogger.h>
#import <SignalUtilitiesKit/Environment.h>

View File

@ -5,6 +5,7 @@
#import "PrivacySettingsTableViewController.h"
#import "BlockListViewController.h"
#import "Session-Swift.h"
#import <SignalCoreKit/NSString+OWS.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSPreferences.h>
#import <SignalUtilitiesKit/ThreadUtil.h>

View File

@ -7,7 +7,7 @@
#import "UIView+OWS.h"
#import <MetalKit/MetalKit.h>
#import <PureLayout/PureLayout.h>
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/Threading.h>
#import <WebRTC/RTCEAGLVideoView.h>
#import <WebRTC/RTCMTLVideoView.h>
#import <WebRTC/RTCVideoRenderer.h>

View File

@ -7,7 +7,7 @@
#import "ConversationViewController.h"
#import "Session-Swift.h"
#import "SignalsNavigationController.h"
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/DebugLogger.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSPrimaryStorage.h>

View File

@ -6,7 +6,7 @@
#import "Session-Swift.h"
#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>
#import <SessionProtocolKit/Threading.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/UIUtil.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -8,7 +8,8 @@
#import "OWSNavigationController.h"
#import "Session-Swift.h"
#import "ViewControllerUtils.h"
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/NSString+OWS.h>
#import <SignalUtilitiesKit/BlockListUIUtils.h>
#import <SignalUtilitiesKit/ContactTableViewCell.h>
#import <SignalUtilitiesKit/ContactsViewHelper.h>

View File

@ -8,6 +8,6 @@ extension Storage {
}
public func getUserPublicKey() -> String? {
return OWSIdentityManager.shared().identityKeyPair()?.publicKey()?.toHexString()
return OWSIdentityManager.shared().identityKeyPair()?.publicKey.toHexString()
}
}

View File

@ -8,7 +8,7 @@ enum KeyPairUtilities {
let ed25519KeyPair = Sodium().sign.keyPair(seed: (seed + padding).bytes)!
let x25519PublicKey = Sodium().sign.toX25519(ed25519PublicKey: ed25519KeyPair.publicKey)!
let x25519SecretKey = Sodium().sign.toX25519(ed25519SecretKey: ed25519KeyPair.secretKey)!
let x25519KeyPair = ECKeyPair(publicKey: Data(x25519PublicKey), privateKey: Data(x25519SecretKey))
let x25519KeyPair = try! ECKeyPair(publicKeyData: Data(x25519PublicKey), privateKeyData: Data(x25519SecretKey))
return (ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair)
}

View File

@ -132,9 +132,9 @@ final class LandingVC : BaseVC, LinkDeviceVCDelegate, DeviceLinkingModalDelegate
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), accessibilityIdentifier: nil, style: .default, handler: nil))
return present(alert, animated: true, completion: nil)
}
let seed = Randomness.generateRandomBytes(16)!
let seed = Randomness.generateRandomBytes(16)
preconditionFailure("This code path shouldn't be invoked.")
let keyPair = Curve25519.generateKeyPair()!
let keyPair = Curve25519.generateKeyPair()
let identityManager = OWSIdentityManager.shared()
let databaseConnection = identityManager.value(forKey: "dbConnection") as! YapDatabaseConnection
databaseConnection.setObject(seed.toHexString(), forKey: "LKLokiSeed", inCollection: OWSPrimaryStorageIdentityKeyStoreCollection)

View File

@ -222,7 +222,7 @@ final class NewClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelegat
}
let members = selectedContacts + [ masterPublicKey ]
let admins = [ masterPublicKey ]
let groupID = LKGroupUtilities.getEncodedClosedGroupIDAsData(Randomness.generateRandomBytes(kGroupIdLength)!.toHexString())
let groupID = LKGroupUtilities.getEncodedClosedGroupIDAsData(Randomness.generateRandomBytes(kGroupIdLength).toHexString())
let group = TSGroupModel(title: name, memberIds: members, image: nil, groupId: groupID, groupType: .closedGroup, adminIds: admins)
let thread = TSGroupThread.getOrCreateThread(with: group)
OWSProfileManager.shared().addThread(toProfileWhitelist: thread)

View File

@ -146,7 +146,7 @@ public final class OpenGroupAPI : DotNetAPI {
guard let userKeyPair = storage.getUserKeyPair() else { return Promise(error: Error.generic) }
guard let userDisplayName = storage.getUserDisplayName() else { return Promise(error: Error.generic) }
let (promise, seal) = Promise<OpenGroupMessage>.pending()
DispatchQueue.global(qos: .userInitiated).async { [privateKey = userKeyPair.privateKey()] in
DispatchQueue.global(qos: .userInitiated).async { [privateKey = userKeyPair.privateKey] in
guard let signedMessage = message.sign(with: privateKey) else { return seal.reject(Error.signingFailed) }
attempt(maxRetryCount: maxRetryCount, recoveringOn: DispatchQueue.global(qos: .default)) {
getOpenGroupServerPublicKey(for: server).then(on: DispatchQueue.global(qos: .default)) { serverPublicKey in
@ -166,7 +166,7 @@ public final class OpenGroupAPI : DotNetAPI {
throw Error.parsingFailed
}
let timestamp = UInt64(date.timeIntervalSince1970) * 1000
return OpenGroupMessage(serverID: serverID, senderPublicKey: userKeyPair.publicKey()!.toHexString(), displayName: displayName, profilePicture: signedMessage.profilePicture, body: body, type: openGroupMessageType, timestamp: timestamp, quote: signedMessage.quote, attachments: signedMessage.attachments, signature: signedMessage.signature, serverTimestamp: timestamp)
return OpenGroupMessage(serverID: serverID, senderPublicKey: userKeyPair.publicKey.toHexString(), displayName: displayName, profilePicture: signedMessage.profilePicture, body: body, type: openGroupMessageType, timestamp: timestamp, quote: signedMessage.quote, attachments: signedMessage.attachments, signature: signedMessage.signature, serverTimestamp: timestamp)
}
}
}.handlingInvalidAuthTokenIfNeeded(for: server)

View File

@ -117,8 +117,8 @@ public final class OpenGroupMessage : NSObject {
SNLog("Failed to sign open group message.")
return nil
}
let userKeyPair = Configuration.shared.storage.getUserKeyPair()
guard let signatureData = Ed25519.sign(data, with: userKeyPair) else {
let userKeyPair = Configuration.shared.storage.getUserKeyPair()!
guard let signatureData = try? Ed25519.sign(data, with: userKeyPair) else {
SNLog("Failed to sign open group message.")
return nil
}
@ -130,7 +130,7 @@ public final class OpenGroupMessage : NSObject {
guard let signature = signature else { return false }
guard let data = getValidationData(for: signature.version) else { return false }
let publicKey = Data(hex: self.senderPublicKey.removing05PrefixIfNeeded())
return Ed25519.verifySignature(signature.data, publicKey: publicKey, data: data)
return (try? Ed25519.verifySignature(signature.data, publicKey: publicKey, data: data)) ?? false
}
// MARK: JSON

View File

@ -28,13 +28,12 @@ internal extension MessageReceiver {
throw Error.noGroupPrivateKey
}
let groupPrivateKey = Data(hex: hexEncodedGroupPrivateKey)
let groupKeyPair = ECKeyPair(publicKey: Data(hex: groupPublicKey), privateKey: groupPrivateKey)
// 2. ) Parse the wrapper
let wrapper = try SNProtoClosedGroupCiphertextMessageWrapper.parseData(data)
let ivAndCiphertext = wrapper.ciphertext
let ephemeralPublicKey = wrapper.ephemeralPublicKey
// 3. ) Decrypt the data inside
guard let ephemeralSharedSecret = Curve25519.generateSharedSecret(fromPublicKey: ephemeralPublicKey, andKeyPair: groupKeyPair) else {
guard let ephemeralSharedSecret = try? Curve25519.generateSharedSecret(fromPublicKey: ephemeralPublicKey, privateKey: groupPrivateKey) else {
throw Error.sharedSecretGenerationFailed
}
let salt = "LOKI"

View File

@ -4,6 +4,7 @@ import PromiseKit
import SessionProtocolKit
import SessionSnodeKit
import SessionUtilitiesKit
import SignalCoreKit
/// Base class for `FileServerAPI` and `OpenGroupAPI`.
public class DotNetAPI : NSObject {
@ -40,7 +41,7 @@ public class DotNetAPI : NSObject {
private static func requestNewAuthToken(for server: String) -> Promise<String> {
SNLog("Requesting auth token for server: \(server).")
guard let userKeyPair = Configuration.shared.storage.getUserKeyPair() else { return Promise(error: Error.generic) }
let queryParameters = "pubKey=\(userKeyPair.publicKey().toHexString())"
let queryParameters = "pubKey=\(userKeyPair.publicKey.toHexString())"
let url = URL(string: "\(server)/loki/v1/get_challenge?\(queryParameters)")!
let request = TSRequest(url: url)
let serverPublicKeyPromise = (server == FileServerAPI.server) ? Promise.value(FileServerAPI.publicKey)
@ -56,10 +57,10 @@ public class DotNetAPI : NSObject {
if serverPublicKey.count == 33 {
let hexEncodedServerPublicKey = serverPublicKey.toHexString()
let startIndex = hexEncodedServerPublicKey.index(hexEncodedServerPublicKey.startIndex, offsetBy: 2)
serverPublicKey = Data.data(fromHex: String(hexEncodedServerPublicKey[startIndex..<hexEncodedServerPublicKey.endIndex]))!
serverPublicKey = Data(hex: String(hexEncodedServerPublicKey[startIndex..<hexEncodedServerPublicKey.endIndex]))
}
// The challenge is prefixed by the 16 bit IV
guard let tokenAsData = try? DiffieHellman.decrypt(challenge, publicKey: serverPublicKey, privateKey: userKeyPair.privateKey()),
guard let tokenAsData = try? DiffieHellman.decrypt(challenge, publicKey: serverPublicKey, privateKey: userKeyPair.privateKey),
let token = String(bytes: tokenAsData, encoding: .utf8) else {
throw Error.decryptionFailed
}
@ -149,7 +150,7 @@ public class DotNetAPI : NSObject {
if isEncryptionRequired {
var encryptionKey = NSData()
var digest = NSData()
guard let encryptedAttachmentData = Cryptography.encryptAttachmentData(unencryptedAttachmentData, outKey: &encryptionKey, outDigest: &digest) else {
guard let encryptedAttachmentData = Cryptography.encryptAttachmentData(unencryptedAttachmentData, shouldPad: true, outKey: &encryptionKey, outDigest: &digest) else {
SNLog("Couldn't encrypt attachment.")
return seal.reject(Error.encryptionFailed)
}

View File

@ -6,18 +6,10 @@ FOUNDATION_EXPORT const unsigned char SessionProtocolKitVersionString[];
#import <SessionProtocolKit/AxolotlStore.h>
#import <SessionProtocolKit/AxolotlExceptions.h>
#import <SessionProtocolKit/ClosedGroupCiphertextMessage.h>
#import <SessionProtocolKit/Cryptography.h>
#import <SessionProtocolKit/FallbackMessage.h>
#import <SessionProtocolKit/NSData+keyVersionByte.h>
#import <SessionProtocolKit/NSData+messagePadding.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SessionProtocolKit/NSDate+OWS.h>
#import <SessionProtocolKit/NSObject+OWS.h>
#import <SessionProtocolKit/NSString+OWS.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SessionProtocolKit/OWSLogs.h>
#import <SessionProtocolKit/PreKeyBundle.h>
#import <SessionProtocolKit/SerializationUtilities.h>
#import <SessionProtocolKit/SessionBuilder.h>
#import <SessionProtocolKit/SessionCipher.h>
#import <SessionProtocolKit/Threading.h>

View File

@ -1,6 +1,6 @@
#import "ClosedGroupCiphertextMessage.h"
#import "AxolotlExceptions.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SessionProtocolKit/SessionProtocolKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -7,8 +7,8 @@
#import "Constants.h"
#import "SerializationUtilities.h"
#import <SessionProtocolKit/SessionProtocolKit-Swift.h>
#import <SessionProtocolKit/SCKExceptionWrapper.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -7,10 +7,11 @@
#import "Constants.h"
#import "NSData+keyVersionByte.h"
#import "SerializationUtilities.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SessionProtocolKit/SessionProtocolKit-Swift.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SessionProtocolKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/NSData+OWS.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/SignalCoreKit-Swift.h>
#import <SessionProtocolKit/SessionProtocolKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -8,7 +8,7 @@
#import <CommonCrypto/CommonCryptor.h>
#import <CommonCrypto/CommonHMAC.h>
#import <Security/Security.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -1,34 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
// See:
// https://github.com/signalapp/libsignal-protocol-java/blob/87fae0f98332e98a32bbb82515428b4edeb4181f/java/src/main/java/org/whispersystems/libsignal/ecc/ECPrivateKey.java
@objc public class ECPrivateKey: NSObject {
@objc
public let keyData: Data
@objc
public init(keyData: Data) throws {
guard keyData.count == ECCKeyLength else {
throw SMKError.assertionError(description: "\(ECPrivateKey.logTag) key has invalid length")
}
self.keyData = keyData
}
open override func isEqual(_ object: Any?) -> Bool {
if let object = object as? ECPrivateKey {
return keyData == object.keyData
} else {
return false
}
}
public override var hash: Int {
return keyData.hashValue
}
}

View File

@ -1,61 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
// See:
// https://github.com/signalapp/libsignal-protocol-java/blob/87fae0f98332e98a32bbb82515428b4edeb4181f/java/src/main/java/org/whispersystems/libsignal/ecc/DjbECPublicKey.java
@objc public class ECPublicKey: NSObject {
@objc
public static let keyTypeDJB: UInt8 = 0x05
@objc
public let keyData: Data
@objc
public init(keyData: Data) throws {
guard keyData.count == ECCKeyLength else {
throw SMKError.assertionError(description: "\(ECPublicKey.logTag) key has invalid length")
}
self.keyData = keyData
}
// https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/ecc/Curve.java#L30
@objc
public init(serializedKeyData: Data) throws {
let parser = OWSDataParser(data: serializedKeyData)
let typeByte = try parser.nextByte(name: "type byte")
guard typeByte == ECPublicKey.keyTypeDJB else {
throw SMKError.assertionError(description: "\(ECPublicKey.logTag) key data has invalid type byte")
}
let keyData = try parser.remainder(name: "key data")
guard keyData.count == ECCKeyLength else {
throw SMKError.assertionError(description: "\(ECPublicKey.logTag) key has invalid length")
}
self.keyData = keyData
}
@objc public var serialized: Data {
let typeBytes = [ECPublicKey.keyTypeDJB]
let typeData = Data(bytes: typeBytes)
return NSData.join([typeData, keyData])
}
open override func isEqual(_ object: Any?) -> Bool {
if let object = object as? ECPublicKey {
return keyData == object.keyData
} else {
return false
}
}
public override var hash: Int {
return keyData.hashValue
}
}

View File

@ -20,8 +20,7 @@ import SessionUtilitiesKit
private lazy var symmetricKey: Data? = {
guard let privateKey = privateKey else { return nil }
let keyPair = ECKeyPair(publicKey: recipientPublicKeyAsData, privateKey: privateKey)
return Curve25519.generateSharedSecret(fromPublicKey: recipientPublicKeyAsData, andKeyPair: keyPair)
return try? Curve25519.generateSharedSecret(fromPublicKey: recipientPublicKeyAsData, privateKey: privateKey)
}()
@objc public init(recipientPublicKey: String, privateKey: Data?) {

View File

@ -7,7 +7,7 @@
//
#import "PreKeyBundle.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
static NSString* const kCoderPKBIdentityKey = @"kCoderPKBIdentityKey";

View File

@ -7,7 +7,7 @@
//
#import "PreKeyRecord.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
static NSString* const kCoderPreKeyId = @"kCoderPreKeyId";
static NSString* const kCoderPreKeyPair = @"kCoderPreKeyPair";

View File

@ -3,7 +3,7 @@
//
#import "SignedPrekeyRecord.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
static NSString* const kCoderPreKeyId = @"kCoderPreKeyId";
static NSString* const kCoderPreKeyPair = @"kCoderPreKeyPair";

View File

@ -7,7 +7,7 @@
//
#import "AliceAxolotlParameters.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
@implementation AliceAxolotlParameters

View File

@ -7,7 +7,7 @@
//
#import "BobAxolotlParameters.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
@implementation BobAxolotlParameters

View File

@ -6,7 +6,7 @@
#import "TSDerivedSecrets.h"
#import <CommonCrypto/CommonCrypto.h>
#import <Curve25519Kit/Curve25519.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -7,7 +7,7 @@
//
#import "MessageKeys.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
static NSString* const kCoderMessageKeysCipherKey = @"kCoderMessageKeysCipherKey";
static NSString* const kCoderMessageKeysMacKey = @"kCoderMessageKeysMacKey";

View File

@ -5,7 +5,7 @@
#import "RKCK.h"
#import <Curve25519Kit/Curve25519.h>
#import "TSDerivedSecrets.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
@implementation RKCK

View File

@ -10,8 +10,8 @@
#import "SessionState.h"
#import <Curve25519Kit/Curve25519.h>
#import <HKDFKit/HKDFKit.h>
#import <SessionProtocolKit/SCKExceptionWrapper.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/OWSAsserts.h>
@interface DHEResult : NSObject
@ -140,28 +140,28 @@
if ([parameters isKindOfClass:[AliceAxolotlParameters class]]) {
AliceAxolotlParameters *params = (AliceAxolotlParameters*)parameters;
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirSignedPreKey
andKeyPair:params.ourIdentityKeyPair]];
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirIdentityKey
andKeyPair:params.ourBaseKey]];
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirSignedPreKey
andKeyPair:params.ourBaseKey]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirSignedPreKey
andKeyPair:params.ourIdentityKeyPair]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirIdentityKey
andKeyPair:params.ourBaseKey]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirSignedPreKey
andKeyPair:params.ourBaseKey]];
if (params.theirOneTimePrekey) {
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirOneTimePrekey
andKeyPair:params.ourBaseKey]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirOneTimePrekey
andKeyPair:params.ourBaseKey]];
}
} else if ([parameters isKindOfClass:[BobAxolotlParameters class]]){
BobAxolotlParameters *params = (BobAxolotlParameters*)parameters;
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirIdentityKey
andKeyPair:params.ourSignedPrekey]];
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirBaseKey
andKeyPair:params.ourIdentityKeyPair]];
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirBaseKey
andKeyPair:params.ourSignedPrekey]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirIdentityKey
andKeyPair:params.ourSignedPrekey]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirBaseKey
andKeyPair:params.ourIdentityKeyPair]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirBaseKey
andKeyPair:params.ourSignedPrekey]];
if (params.ourOneTimePrekey) {
[masterKey appendData:[Curve25519 generateSharedSecretFromPublicKey:params.theirBaseKey
andKeyPair:params.ourOneTimePrekey]];
[masterKey appendData:[Curve25519 throws_generateSharedSecretFromPublicKey:params.theirBaseKey
andKeyPair:params.ourOneTimePrekey]];
}
}

View File

@ -7,7 +7,7 @@
//
#import "ReceivingChain.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
@interface ReceivingChain ()

View File

@ -7,7 +7,7 @@
#import "RKCK.h"
#import "TSDerivedSecrets.h"
#import <Curve25519Kit/Curve25519.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
static NSString* const kCoderData = @"kCoderData";
@ -48,7 +48,7 @@ static NSString* const kCoderData = @"kCoderData";
OWSAssert(theirEphemeral);
OWSAssert(ourEphemeral);
NSData *sharedSecret = [Curve25519 generateSharedSecretFromPublicKey:theirEphemeral andKeyPair:ourEphemeral];
NSData *sharedSecret = [Curve25519 throws_generateSharedSecretFromPublicKey:theirEphemeral andKeyPair:ourEphemeral];
OWSAssert(sharedSecret.length == 32);
TSDerivedSecrets *secrets =

View File

@ -4,7 +4,7 @@
#import "SendingChain.h"
#import "ChainKey.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
@interface SendingChain ()

View File

@ -4,7 +4,7 @@
#import "TSDerivedSecrets.h"
#import <Curve25519Kit/Curve25519.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <HKDFKit/HKDFKit.h>
@implementation TSDerivedSecrets

View File

@ -3,6 +3,7 @@
//
import Foundation
import SignalCoreKit
public enum SMKCertificateError: Error {
case invalidCertificate(description: String)

View File

@ -4,6 +4,7 @@
import Foundation
import HKDFKit
import SignalCoreKit
@objc
public class SecretSessionKnownSenderError: NSObject, CustomNSError {
@ -38,32 +39,6 @@ public enum SMKSecretSessionCipherError: Int, Error {
case selfSentMessage
}
// See:
// https://github.com/signalapp/libsignal-metadata-java/blob/master/java/src/main/java/org/signal/libsignal/metadata/SecretSessionCipher.java
public extension ECKeyPair {
// TODO: Rename to publicKey(), rename existing publicKey() method to publicKeyData().
func ecPublicKey() throws -> ECPublicKey {
guard publicKey().count == ECCKeyLength else {
throw SMKError.assertionError(description: "\(logTag) public key has invalid length")
}
// NOTE: we don't use ECPublicKey(serializedKeyData:) since the
// key data should not have a type byte.
return try ECPublicKey(keyData: publicKey())
}
// TODO: Rename to privateKey(), rename existing privateKey() method to privateKeyData().
func ecPrivateKey() throws -> ECPrivateKey {
guard privateKey().count == ECCKeyLength else {
throw SMKError.assertionError(description: "\(logTag) private key has invalid length")
}
return try ECPrivateKey(keyData: privateKey())
}
}
// MARK: -
private class SMKSecretKeySpec: NSObject {
@ -182,7 +157,7 @@ public class SMKDecryptResult: NSObject {
let encryptedMessage: CipherMessage
if useFallbackSessionCipher {
let cipher = FallBackSessionCipher(recipientPublicKey: recipientPublicKey, privateKey: try ourIdentityKeyPair.privateKey())
let cipher = FallBackSessionCipher(recipientPublicKey: recipientPublicKey, privateKey: try ourIdentityKeyPair.privateKey)
let ivAndCiphertext = cipher.encrypt(paddedPlaintext)!
encryptedMessage = FallbackMessage(_throws_with: ivAndCiphertext)
} else {
@ -207,7 +182,7 @@ public class SMKDecryptResult: NSObject {
// key data should not have a type byte.
let theirIdentityKey = try ECPublicKey(keyData: theirIdentityKeyData)
let ephemeral = Curve25519.generateKeyPair()!
let ephemeral = Curve25519.generateKeyPair()
guard let prefixData = kUDPrefixString.data(using: String.Encoding.utf8) else {
throw SMKError.assertionError(description: "\(logTag) Could not encode prefix.")
@ -388,8 +363,7 @@ public class SMKDecryptResult: NSObject {
//
// See:
// https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/ecc/Curve.java#L30
let keyPair = ECKeyPair(publicKey: ephemeralPublicKey.keyData, privateKey: ephemeralPrivateKey.keyData)
let ephemeralSecret = try Curve25519.generateSharedSecret(fromPublicKey: ephemeralPublicKey.keyData, andKeyPair: keyPair)
let ephemeralSecret = try Curve25519.generateSharedSecret(fromPublicKey: ephemeralPublicKey.keyData, privateKey: ephemeralPrivateKey.keyData)
// byte[] ephemeralDerived = new HKDFv3().deriveSecrets(ephemeralSecret, salt, new byte[0], 96);
let kEphemeralDerivedLength: UInt = 96
@ -429,8 +403,7 @@ public class SMKDecryptResult: NSObject {
//
// See:
// https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/ecc/Curve.java#L30
let keyPair = ECKeyPair(publicKey: staticPublicKey.keyData, privateKey: staticPrivateKey.keyData)
let staticSecret = Curve25519.generateSharedSecret(fromPublicKey: staticPublicKey.keyData, andKeyPair: keyPair)
let staticSecret = try Curve25519.generateSharedSecret(fromPublicKey: staticPublicKey.keyData, privateKey: staticPrivateKey.keyData)
// byte[] staticDerived = new HKDFv3().deriveSecrets(staticSecret, salt, new byte[0], 96);
let kStaticDerivedLength: UInt = 96
@ -509,7 +482,7 @@ public class SMKDecryptResult: NSObject {
case .prekey:
cipherMessage = try PreKeyWhisperMessage(data: messageContent.contentData)
case .fallback:
let privateKey = try? identityStore.identityKeyPair(protocolContext)?.privateKey()
let privateKey = try? identityStore.identityKeyPair(protocolContext)?.privateKey
let cipher = FallBackSessionCipher(recipientPublicKey: senderRecipientId, privateKey: privateKey)
let plaintext = cipher.decrypt(messageContent.contentData)!
return plaintext

View File

@ -3,6 +3,7 @@
//
import Foundation
import SignalCoreKit
@objc
public class SMKUDAccessKey: NSObject {
@ -22,7 +23,7 @@ public class SMKUDAccessKey: NSObject {
// We derive the "ud access key" from the private key by encrypting zeroes.
let emptyPlaintextLength = 16
let emptyPlaintext = Data(count: Int(emptyPlaintextLength))
let initializationVector = Data(count: Int(kAESGCM256_IVLength))
let initializationVector = Data(count: Int(kAESGCM256_DefaultIVLength))
guard let keyData = Cryptography.encryptAESGCM(plainTextData: emptyPlaintext,
initializationVector: initializationVector,
additionalAuthenticatedData: nil,

View File

@ -3,6 +3,7 @@
//
import Foundation
import SignalCoreKit
// https://github.com/signalapp/libsignal-metadata-java/blob/master/java/src/main/java/org/signal/libsignal/metadata/protocol/UnidentifiedSenderMessage.java
@objc public class SMKUnidentifiedSenderMessage: NSObject {

View File

@ -19,8 +19,9 @@
#import <Curve25519Kit/Curve25519.h>
#import <Curve25519Kit/Ed25519.h>
#import <HKDFKit/HKDFKit.h>
#import <SessionProtocolKit/SCKExceptionWrapper.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/SignalCoreKit.h>
#import <SignalCoreKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -15,9 +15,9 @@
#import "SessionState.h"
#import <Curve25519Kit/Curve25519.h>
#import <Curve25519Kit/Ed25519.h>
#import <SessionProtocolKit/NSData+OWS.h>
#import <SessionProtocolKit/SCKExceptionWrapper.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/NSData+OWS.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN
@ -106,9 +106,9 @@ const int kPreKeyOfLastResortId = 0xFFFFFF;
}
// NOTE: we use preKeyBundle.signedPreKeyPublic which has the key type byte.
if (![Ed25519 verifySignature:preKeyBundle.signedPreKeySignature
publicKey:theirIdentityKey
data:preKeyBundle.signedPreKeyPublic]) {
if (![Ed25519 throws_verifySignature:preKeyBundle.signedPreKeySignature
publicKey:theirIdentityKey
data:preKeyBundle.signedPreKeyPublic]) {
@throw [NSException exceptionWithName:InvalidKeyException reason:@"KeyIsNotValidlySigned" userInfo:nil];
}

View File

@ -3,7 +3,7 @@
//
#import "SessionRecord.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
#define ARCHIVED_STATES_MAX_LENGTH 40

View File

@ -7,7 +7,7 @@
#import "ReceivingChain.h"
#import "SendingChain.h"
#import "ChainAndIndex.h"
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
@implementation PendingPreKey

View File

@ -1,161 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern const NSUInteger kAES256_KeyByteLength;
extern const NSUInteger kAESGCM256_IVLength;
extern const NSUInteger kAES256CTR_IVLength;
extern const NSUInteger SCKErrorCodeFailedToDecryptMessage;
/// Key appropriate for use in AES256-GCM
@interface OWSAES256Key : NSObject <NSSecureCoding>
/// Generates new secure random key
- (instancetype)init;
+ (instancetype)generateRandomKey;
/**
* @param data representing the raw key bytes
*
* @returns a new instance if key is of appropriate length for AES256-GCM
* else returns nil.
*/
+ (nullable instancetype)keyWithData:(NSData *)data;
/// The raw key material
@property (nonatomic, readonly) NSData *keyData;
@end
#pragma mark -
// TODO: This class should probably be renamed to: AES256GCMEncryptionResult
// (note the missing 6 in 256).
@interface AES25GCMEncryptionResult : NSObject
@property (nonatomic, readonly) NSData *ciphertext;
@property (nonatomic, readonly) NSData *initializationVector;
@property (nonatomic, readonly) NSData *authTag;
- (instancetype)init NS_UNAVAILABLE;
- (nullable instancetype)initWithCipherText:(NSData *)cipherText
initializationVector:(NSData *)initializationVector
authTag:(NSData *)authTag NS_DESIGNATED_INITIALIZER;
@end
#pragma mark -
@interface AES256CTREncryptionResult : NSObject
@property (nonatomic, readonly) NSData *ciphertext;
@property (nonatomic, readonly) NSData *initializationVector;
- (instancetype)init NS_UNAVAILABLE;
- (nullable instancetype)initWithCiphertext:(NSData *)ciphertext
initializationVector:(NSData *)initializationVector NS_DESIGNATED_INITIALIZER;
@end
#pragma mark -
@interface Cryptography : NSObject
typedef NS_ENUM(NSInteger, TSMACType) {
TSHMACSHA256Truncated10Bytes = 2,
TSHMACSHA256AttachementType = 3
};
+ (NSData *)generateRandomBytes:(NSUInteger)numberBytes;
+ (uint32_t)randomUInt32;
+ (uint64_t)randomUInt64;
+ (unsigned)randomUnsigned;
#pragma mark - SHA and HMAC methods
// Full length SHA256 digest for `data`
+ (nullable NSData *)computeSHA256Digest:(NSData *)data;
// Truncated SHA256 digest for `data`
+ (nullable NSData *)computeSHA256Digest:(NSData *)data truncatedToBytes:(NSUInteger)truncatedBytes;
+ (nullable NSString *)truncatedSHA1Base64EncodedWithoutPadding:(NSString *)string;
+ (nullable NSData *)decryptAppleMessagePayload:(NSData *)payload withSignalingKey:(NSString *)signalingKeyString;
+ (nullable NSData *)computeSHA256HMAC:(NSData *)data withHMACKey:(NSData *)HMACKey;
+ (nullable NSData *)truncatedSHA256HMAC:(NSData *)dataToHMAC
withHMACKey:(NSData *)HMACKey
truncation:(NSUInteger)truncation;
#pragma mark - Attachments & Stickers
// Though digest can and will be nil for legacy clients, we now reject attachments lacking a digest.
+ (nullable NSData *)decryptAttachment:(NSData *)dataToDecrypt
withKey:(NSData *)key
digest:(nullable NSData *)digest
unpaddedSize:(UInt32)unpaddedSize
error:(NSError **)error;
+ (nullable NSData *)decryptStickerData:(NSData *)dataToDecrypt
withKey:(NSData *)key
error:(NSError **)error;
+ (nullable NSData *)encryptAttachmentData:(NSData *)attachmentData
outKey:(NSData *_Nonnull *_Nullable)outKey
outDigest:(NSData *_Nonnull *_Nullable)outDigest;
#pragma mark - AES-GCM
+ (nullable AES25GCMEncryptionResult *)encryptAESGCMWithData:(NSData *)plaintext
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
key:(OWSAES256Key *)key
NS_SWIFT_NAME(encryptAESGCM(plainTextData:additionalAuthenticatedData:key:));
+ (nullable AES25GCMEncryptionResult *)encryptAESGCMWithData:(NSData *)plaintext
initializationVector:(NSData *)initializationVector
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
key:(OWSAES256Key *)key
NS_SWIFT_NAME(encryptAESGCM(plainTextData:initializationVector:additionalAuthenticatedData:key:));
+ (nullable NSData *)decryptAESGCMWithInitializationVector:(NSData *)initializationVector
ciphertext:(NSData *)ciphertext
additionalAuthenticatedData:(nullable NSData *)additionalAuthenticatedData
authTag:(NSData *)authTagFromEncrypt
key:(OWSAES256Key *)key
NS_SWIFT_NAME(decryptAESGCM(withInitializationVector:ciphertext:additionalAuthenticatedData:authTag:key:));
#pragma mark - Profiles
+ (nullable NSData *)encryptAESGCMWithProfileData:(NSData *)plaintextData key:(OWSAES256Key *)key
NS_SWIFT_NAME(encryptAESGCMProfileData(plainTextData:key:));
+ (nullable NSData *)decryptAESGCMWithProfileData:(NSData *)encryptedData key:(OWSAES256Key *)key
NS_SWIFT_NAME(decryptAESGCMProfileData(encryptedData:key:));
#pragma mark - AES-CTR
+ (nullable AES256CTREncryptionResult *)encryptAESCTRWithData:(NSData *)plaintext
initializationVector:(NSData *)initializationVector
key:(OWSAES256Key *)key
NS_SWIFT_NAME(encryptAESCTR(plaintextData:initializationVector:key:));
+ (nullable NSData *)decryptAESCTRWithCipherText:(NSData *)cipherText
initializationVector:(NSData *)initializationVector
key:(OWSAES256Key *)key
NS_SWIFT_NAME(decryptAESCTR(cipherText:initializationVector:key:));
#pragma mark -
+ (void)seedRandom;
@end
NS_ASSUME_NONNULL_END

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
extension Data {
public var hexadecimalString: String {
return (self as NSData).hexadecimalString()
}
public static func data(fromHex hexString: String) -> Data? {
guard let data = NSData(fromHexString : hexString) else {
return nil
}
return data as Data
}
public func ows_constantTimeIsEqual(to other: Data) -> Bool {
return (self as NSData).ows_constantTimeIsEqual(to: other)
}
}

View File

@ -1,77 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
// Once we're on Swift4.2 we can mark this as inlineable
// @inlinable
public func owsFormatLogMessage(_ logString: String,
file: String = #file,
function: String = #function,
line: Int = #line) -> String {
let filename = (file as NSString).lastPathComponent
// We format the filename & line number in a format compatible
// with XCode's "Open Quickly..." feature.
return "[\(filename):\(line) \(function)]: \(logString)"
}
/**
* A minimal DDLog wrapper for swift.
*/
open class Logger: NSObject {
open class func verbose(_ logString: @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
guard ShouldLogVerbose() else {
return
}
OWSLogger.verbose(owsFormatLogMessage(logString(), file: file, function: function, line: line))
}
open class func debug(_ logString: @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
guard ShouldLogDebug() else {
return
}
OWSLogger.debug(owsFormatLogMessage(logString(), file: file, function: function, line: line))
}
open class func info(_ logString: @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
guard ShouldLogInfo() else {
return
}
OWSLogger.info(owsFormatLogMessage(logString(), file: file, function: function, line: line))
}
open class func warn(_ logString: @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
guard ShouldLogWarning() else {
return
}
OWSLogger.warn(owsFormatLogMessage(logString(), file: file, function: function, line: line))
}
open class func error(_ logString: @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
guard ShouldLogError() else {
return
}
OWSLogger.error(owsFormatLogMessage(logString(), file: file, function: function, line: line))
}
open class func flush() {
OWSLogger.flush()
}
}

View File

@ -1,37 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSData (OWS)
+ (NSData *)join:(NSArray<NSData *> *)datas;
- (NSData *)dataByAppendingData:(NSData *)data;
#pragma mark - Hex
- (NSString *)hexadecimalString;
+ (nullable NSData *)dataFromHexString:(NSString *)hexString;
#pragma mark - Base64
+ (nullable NSData *)dataFromBase64StringNoPadding:(NSString *)aString;
+ (nullable NSData *)dataFromBase64String:(NSString *)aString;
- (NSString *)base64EncodedString;
#pragma mark -
/**
* Compares data in constant time so as to help avoid potential timing attacks.
*/
- (BOOL)ows_constantTimeIsEqualToData:(NSData *)other;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,147 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "NSData+OWS.h"
#import <SessionProtocolKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN
@implementation NSData (OWS)
+ (NSData *)join:(NSArray<NSData *> *)datas
{
OWSAssert(datas);
NSMutableData *result = [NSMutableData new];
for (NSData *data in datas) {
[result appendData:data];
}
return [result copy];
}
- (NSData *)dataByAppendingData:(NSData *)data
{
NSMutableData *result = [self mutableCopy];
[result appendData:data];
return [result copy];
}
#pragma mark - Hex
- (NSString *)hexadecimalString
{
/* Returns hexadecimal string of NSData. Empty string if data is empty. */
const unsigned char *dataBuffer = (const unsigned char *)[self bytes];
if (!dataBuffer) {
return @"";
}
NSUInteger dataLength = [self length];
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
for (NSUInteger i = 0; i < dataLength; ++i) {
[hexString appendFormat:@"%02x", dataBuffer[i]];
}
return [hexString copy];
}
+ (nullable NSData *)dataFromHexString:(NSString *)hexString {
NSMutableData *data = [NSMutableData new];
if (hexString.length % 2 != 0) {
OWSFailDebug(@"Hexadecimal string has unexpected length: %@ (%lu)", hexString, (unsigned long)hexString.length);
return nil;
}
for (NSUInteger i = 0; i + 2 <= hexString.length; i += 2) {
NSString *_Nullable byteString = [hexString substringWithRange:NSMakeRange(i, 2)];
if (!byteString) {
OWSFailDebug(@"Couldn't slice hexadecimal string.");
return nil;
}
unsigned byteValue;
if (![[NSScanner scannerWithString:byteString] scanHexInt:&byteValue]) {
OWSFailDebug(@"Couldn't parse hex byte: %@.", byteString);
return nil;
}
if (byteValue > 0xff) {
OWSFailDebug(@"Invalid hex byte: %@ (%d).", byteString, byteValue);
return nil;
}
uint8_t byte = (uint8_t)(0xff & byteValue);
[data appendBytes:&byte length:1];
}
return [data copy];
}
#pragma mark - Base64
+ (nullable NSData *)dataFromBase64StringNoPadding:(NSString *)aString
{
int padding = aString.length % 4;
NSMutableString *strResult = [aString mutableCopy];
if (padding != 0) {
int charsToAdd = 4 - padding;
for (int i = 0; i < charsToAdd; i++) {
[strResult appendString:@"="];
}
}
return [self dataFromBase64String:strResult];
}
//
// dataFromBase64String:
//
// Creates an NSData object containing the base64 decoded representation of
// the base64 string 'aString'
//
// Parameters:
// aString - the base64 string to decode
//
// returns the NSData representation of the base64 string
//
+ (nullable NSData *)dataFromBase64String:(NSString *)aString
{
return [[NSData alloc] initWithBase64EncodedString:aString options:NSDataBase64DecodingIgnoreUnknownCharacters];
}
//
// base64EncodedString
//
// Creates an NSString object that contains the base 64 encoding of the
// receiver's data. Lines are broken at 64 characters long.
//
// returns an NSString being the base 64 representation of the
// receiver.
//
- (NSString *)base64EncodedString
{
return [self base64EncodedStringWithOptions:0];
}
#pragma mark -
- (BOOL)ows_constantTimeIsEqualToData:(NSData *)other
{
volatile UInt8 isEqual = 0;
if (self.length != other.length) {
return NO;
}
UInt8 *leftBytes = (UInt8 *)self.bytes;
UInt8 *rightBytes = (UInt8 *)other.bytes;
for (int i = 0; i < self.length; i++) {
// rather than returning as soon as we find a discrepency, we compare the rest of
// the byte stream to maintain a constant time comparison
isEqual |= leftBytes[i] ^ rightBytes[i];
}
return isEqual == 0;
}
@end
NS_ASSUME_NONNULL_END

View File

@ -4,8 +4,8 @@
#import "NSData+keyVersionByte.h"
#import "AxolotlExceptions.h"
#import <SessionProtocolKit/SCKExceptionWrapper.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/SCKExceptionWrapper.h>
#import <SignalCoreKit/OWSAsserts.h>
@implementation NSData (keyVersionByte)

View File

@ -1,44 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// These NSTimeInterval constants provide simplified durations for readability.
//
// These approximations should never be used for strict date/time calcuations.
extern const NSTimeInterval kSecondInterval;
extern const NSTimeInterval kMinuteInterval;
extern const NSTimeInterval kHourInterval;
extern const NSTimeInterval kDayInterval;
extern const NSTimeInterval kWeekInterval;
extern const NSTimeInterval kMonthInterval;
extern const NSTimeInterval kYearInterval;
#define kSecondInMs ((uint64_t)1000)
#define kMinuteInMs (kSecondInMs * 60)
#define kHourInMs (kMinuteInMs * 60)
#define kDayInMs (kHourInMs * 24)
#define kWeekInMs (kDayInMs * 7)
#define kMonthInMs (kDayInMs * 30)
// kYearsInMs is a double to avoid overflow
#define kYearsInMs (kDayInMs * 365.0)
@interface NSDate (OWS)
+ (uint64_t)ows_millisecondTimeStamp;
+ (NSDate *)ows_dateWithMillisecondsSince1970:(uint64_t)milliseconds;
+ (uint64_t)ows_millisecondsSince1970ForDate:(NSDate *)date;
- (BOOL)isAfterDate:(NSDate *)otherDate;
- (BOOL)isBeforeDate:(NSDate *)otherDate;
- (BOOL)isAfterNow;
- (BOOL)isBeforeNow;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,59 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "NSDate+OWS.h"
#import <chrono>
NS_ASSUME_NONNULL_BEGIN
const NSTimeInterval kSecondInterval = 1;
const NSTimeInterval kMinuteInterval = 60;
const NSTimeInterval kHourInterval = 60 * kMinuteInterval;
const NSTimeInterval kDayInterval = 24 * kHourInterval;
const NSTimeInterval kWeekInterval = 7 * kDayInterval;
const NSTimeInterval kMonthInterval = 30 * kDayInterval;
const NSTimeInterval kYearInterval = 365 * kDayInterval;
@implementation NSDate (OWS)
+ (uint64_t)ows_millisecondTimeStamp
{
uint64_t milliseconds
= (uint64_t)(std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1));
return milliseconds;
}
+ (NSDate *)ows_dateWithMillisecondsSince1970:(uint64_t)milliseconds
{
return [NSDate dateWithTimeIntervalSince1970:(milliseconds / 1000.0)];
}
+ (uint64_t)ows_millisecondsSince1970ForDate:(NSDate *)date
{
return (uint64_t)(date.timeIntervalSince1970 * 1000);
}
- (BOOL)isAfterDate:(NSDate *)otherDate
{
return [self compare:otherDate] == NSOrderedDescending;
}
- (BOOL)isBeforeDate:(NSDate *)otherDate
{
return [self compare:otherDate] == NSOrderedAscending;
}
- (BOOL)isAfterNow
{
return [self isAfterDate:[NSDate new]];
}
- (BOOL)isBeforeNow
{
return [self isBeforeDate:[NSDate new]];
}
@end
NS_ASSUME_NONNULL_END

View File

@ -1,21 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSObject (OWS)
#pragma mark - Logging
@property (nonatomic, readonly) NSString *logTag;
@property (class, nonatomic, readonly) NSString *logTag;
+ (BOOL)isNullableObject:(nullable NSObject *)left equalTo:(nullable NSObject *)right;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,36 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "NSObject+OWS.h"
NS_ASSUME_NONNULL_BEGIN
@implementation NSObject (OWS)
#pragma mark - Logging
+ (NSString *)logTag
{
return [NSString stringWithFormat:@"[%@]", self.class];
}
- (NSString *)logTag
{
return self.class.logTag;
}
+ (BOOL)isNullableObject:(nullable NSObject *)left equalTo:(nullable NSObject *)right
{
if (!left && !right) {
return YES;
} else if (!left || !right) {
return NO;
} else {
return [left isEqual:right];
}
}
@end
NS_ASSUME_NONNULL_END

View File

@ -1,28 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (OWS)
- (NSString *)ows_stripped;
- (NSString *)digitsOnly;
@property (nonatomic, readonly) BOOL hasAnyASCII;
@property (nonatomic, readonly) BOOL isOnlyASCII;
- (NSString *)filterStringForDisplay;
- (NSString *)filterFilename;
- (BOOL)isValidE164;
+ (NSString *)formatDurationSeconds:(uint32_t)durationSeconds useShortFormat:(BOOL)useShortFormat;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,453 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "NSString+OWS.h"
#import "iOSVersions.h"
#import <objc/runtime.h>
#import <SessionProtocolKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN
@interface UnicodeCodeRange : NSObject
@property (nonatomic) unichar first;
@property (nonatomic) unichar last;
@end
#pragma mark -
@implementation UnicodeCodeRange
+ (UnicodeCodeRange *)rangeWithStart:(unichar)first last:(unichar)last
{
OWSAssertDebug(first <= last);
UnicodeCodeRange *range = [UnicodeCodeRange new];
range.first = first;
range.last = last;
return range;
}
- (NSComparisonResult)compare:(UnicodeCodeRange *)other
{
return self.first > other.first;
}
@end
#pragma mark -
static void *kNSString_SSK_hasExcessiveDiacriticals = &kNSString_SSK_hasExcessiveDiacriticals;
@implementation NSString (OWS)
- (NSString *)ows_stripped
{
return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
+ (BOOL)shouldFilterIndic
{
static BOOL result = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
result = (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 3));
});
return result;
}
+ (BOOL)isIndicVowel:(unichar)c
{
static NSArray<UnicodeCodeRange *> *ranges;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// From:
// https://unicode.org/charts/PDF/U0C00.pdf
// https://unicode.org/charts/PDF/U0980.pdf
// https://unicode.org/charts/PDF/U0900.pdf
ranges = [@[
// Telugu:
[UnicodeCodeRange rangeWithStart:0xC05 last:0xC14],
[UnicodeCodeRange rangeWithStart:0xC3E last:0xC4C],
[UnicodeCodeRange rangeWithStart:0xC60 last:0xC63],
// Bengali
[UnicodeCodeRange rangeWithStart:0x985 last:0x994],
[UnicodeCodeRange rangeWithStart:0x9BE last:0x9C8],
[UnicodeCodeRange rangeWithStart:0x9CB last:0x9CC],
[UnicodeCodeRange rangeWithStart:0x9E0 last:0x9E3],
// Devanagari
[UnicodeCodeRange rangeWithStart:0x904 last:0x914],
[UnicodeCodeRange rangeWithStart:0x93A last:0x93B],
[UnicodeCodeRange rangeWithStart:0x93E last:0x94C],
[UnicodeCodeRange rangeWithStart:0x94E last:0x94F],
[UnicodeCodeRange rangeWithStart:0x955 last:0x957],
[UnicodeCodeRange rangeWithStart:0x960 last:0x963],
[UnicodeCodeRange rangeWithStart:0x972 last:0x977],
] sortedArrayUsingSelector:@selector(compare:)];
});
for (UnicodeCodeRange *range in ranges) {
if (c < range.first) {
// For perf, we can take advantage of the fact that the
// ranges are sorted to exit early if the character lies
// before the current range.
return NO;
}
if (range.first <= c && c <= range.last) {
return YES;
}
}
return NO;
}
+ (NSCharacterSet *)problematicCharacterSetForIndicScript
{
static NSCharacterSet *characterSet;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
characterSet = [NSCharacterSet characterSetWithCharactersInString:@"\u200C"];
});
return characterSet;
}
// See: https://manishearth.github.io/blog/2018/02/15/picking-apart-the-crashing-ios-string/
- (NSString *)filterForIndicScripts
{
if (!NSString.shouldFilterIndic) {
return self;
}
if ([self rangeOfCharacterFromSet:[[self class] problematicCharacterSetForIndicScript]].location == NSNotFound) {
return self;
}
NSMutableString *filteredForIndic = [NSMutableString new];
for (NSUInteger index = 0; index < self.length; index++) {
unichar c = [self characterAtIndex:index];
if (c == 0x200C) {
NSUInteger nextIndex = index + 1;
if (nextIndex < self.length) {
unichar next = [self characterAtIndex:nextIndex];
if ([NSString isIndicVowel:next]) {
// Discard ZWNJ (zero-width non-joiner) whenever we find a ZWNJ
// followed by an Indic (Telugu, Bengali, Devanagari) vowel
// and replace it with 0xFFFD, the Unicode "replacement character."
[filteredForIndic appendFormat:@"\uFFFD"];
OWSLogError(@"Filtered unsafe Indic script.");
// Then discard the vowel too.
index++;
continue;
}
}
}
[filteredForIndic appendFormat:@"%C", c];
}
return [filteredForIndic copy];
}
+ (NSCharacterSet *)unsafeFilenameCharacterSet
{
static NSCharacterSet *characterSet;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// 0x202D and 0x202E are the unicode ordering letters
// and can be used to control the rendering of text.
// They could be used to construct misleading attachment
// filenames that appear to have a different file extension,
// for example.
characterSet = [NSCharacterSet characterSetWithCharactersInString:@"\u202D\u202E"];
});
return characterSet;
}
- (NSString *)filterUnsafeFilenameCharacters
{
NSCharacterSet *unsafeCharacterSet = [[self class] unsafeFilenameCharacterSet];
NSRange range = [self rangeOfCharacterFromSet:unsafeCharacterSet];
if (range.location == NSNotFound) {
return self;
}
NSMutableString *filtered = [NSMutableString new];
NSString *remainder = [self copy];
while (range.location != NSNotFound) {
if (range.location > 0) {
[filtered appendString:[remainder substringToIndex:range.location]];
}
// The "replacement" code point.
[filtered appendString:@"\uFFFD"];
remainder = [remainder substringFromIndex:range.location + range.length];
range = [remainder rangeOfCharacterFromSet:unsafeCharacterSet];
}
[filtered appendString:remainder];
return filtered;
}
- (NSString *)filterStringForDisplay
{
return self.ows_stripped.filterForIndicScripts.filterForExcessiveDiacriticals;
}
- (NSString *)filterFilename
{
return self.ows_stripped.filterForIndicScripts.filterForExcessiveDiacriticals.filterUnsafeFilenameCharacters;
}
- (NSString *)filterForExcessiveDiacriticals
{
if (!self.hasExcessiveDiacriticals) {
return self;
}
return [self stringByFoldingWithOptions:NSDiacriticInsensitiveSearch locale:[NSLocale currentLocale]];
}
- (BOOL)hasExcessiveDiacriticals
{
NSNumber *cachedValue = objc_getAssociatedObject(self, kNSString_SSK_hasExcessiveDiacriticals);
if (!cachedValue) {
cachedValue = @([self computeHasExcessiveDiacriticals]);
objc_setAssociatedObject(self, kNSString_SSK_hasExcessiveDiacriticals, cachedValue, OBJC_ASSOCIATION_COPY);
}
return cachedValue.boolValue;
}
- (BOOL)computeHasExcessiveDiacriticals
{
// discard any zalgo style text, by detecting maximum number of glyphs per character
NSUInteger index = 0;
// store in local var, it's a hot code path.
NSUInteger length = self.length;
while (index < length) {
// Walk the grapheme clusters in the string.
NSRange range = [self rangeOfComposedCharacterSequenceAtIndex:index];
if (range.length > 8) {
// There are too many characters in this grapheme cluster.
return YES;
} else if (range.location != index || range.length < 1) {
// This should never happen.
OWSFailDebug(
@"unexpected composed character sequence: %lu, %@", (unsigned long)index, NSStringFromRange(range));
return YES;
}
index = range.location + range.length;
}
return NO;
}
+ (NSRegularExpression *)anyASCIIRegex
{
static dispatch_once_t onceToken;
static NSRegularExpression *regex;
dispatch_once(&onceToken, ^{
NSError *error;
regex = [NSRegularExpression regularExpressionWithPattern:@"[\x00-\x7F]+"
options:0
error:&error];
if (error || !regex) {
// crash! it's not clear how to proceed safely, and this regex should never fail.
OWSFail(@"could not compile regex: %@", error);
}
});
return regex;
}
+ (NSRegularExpression *)onlyASCIIRegex
{
static dispatch_once_t onceToken;
static NSRegularExpression *regex;
dispatch_once(&onceToken, ^{
NSError *error;
regex = [NSRegularExpression regularExpressionWithPattern:@"^[\x00-\x7F]*$"
options:0
error:&error];
if (error || !regex) {
// crash! it's not clear how to proceed safely, and this regex should never fail.
OWSFail(@"could not compile regex: %@", error);
}
});
return regex;
}
- (BOOL)isOnlyASCII;
{
return [self.class.onlyASCIIRegex rangeOfFirstMatchInString:self
options:0
range:NSMakeRange(0, self.length)].location != NSNotFound;
}
- (BOOL)hasAnyASCII
{
return [self.class.anyASCIIRegex rangeOfFirstMatchInString:self
options:0
range:NSMakeRange(0, self.length)].location != NSNotFound;
}
- (BOOL)isValidE164
{
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^\\+\\d+$"
options:NSRegularExpressionCaseInsensitive
error:&error];
if (error || !regex) {
OWSFailDebug(@"could not compile regex: %@", error);
return NO;
}
return [regex rangeOfFirstMatchInString:self options:0 range:NSMakeRange(0, self.length)].location != NSNotFound;
}
+ (NSString *)formatDurationSeconds:(uint32_t)durationSeconds useShortFormat:(BOOL)useShortFormat
{
NSString *amountFormat;
uint32_t duration;
uint32_t secondsPerMinute = 60;
uint32_t secondsPerHour = secondsPerMinute * 60;
uint32_t secondsPerDay = secondsPerHour * 24;
uint32_t secondsPerWeek = secondsPerDay * 7;
if (durationSeconds < secondsPerMinute) { // XX Seconds
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SECONDS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of seconds}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5s' not '5 s'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SECONDS",
@"{{number of seconds}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{5 seconds}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds;
} else if (durationSeconds < secondsPerMinute * 1.5) { // 1 Minute
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_MINUTES_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of minutes}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5m' not '5 m'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_MINUTE",
@"{{1 minute}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{1 minute}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerMinute;
} else if (durationSeconds < secondsPerHour) { // Multiple Minutes
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_MINUTES_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of minutes}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5m' not '5 m'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_MINUTES",
@"{{number of minutes}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{5 minutes}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerMinute;
} else if (durationSeconds < secondsPerHour * 1.5) { // 1 Hour
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_HOURS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of hours}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5h' not '5 h'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_HOUR",
@"{{1 hour}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{1 hour}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerHour;
} else if (durationSeconds < secondsPerDay) { // Multiple Hours
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_HOURS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of hours}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5h' not '5 h'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_HOURS",
@"{{number of hours}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{5 hours}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerHour;
} else if (durationSeconds < secondsPerDay * 1.5) { // 1 Day
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_DAYS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of days}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5d' not '5 d'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_DAY",
@"{{1 day}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{1 day}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerDay;
} else if (durationSeconds < secondsPerWeek) { // Multiple Days
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_DAYS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of days}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5d' not '5 d'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_DAYS",
@"{{number of days}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{5 days}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerDay;
} else if (durationSeconds < secondsPerWeek * 1.5) { // 1 Week
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_WEEKS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of weeks}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5w' not '5 w'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_SINGLE_WEEK",
@"{{1 week}} embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{1 week}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerWeek;
} else { // Multiple weeks
if (useShortFormat) {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_WEEKS_SHORT_FORMAT",
@"Label text below navbar button, embeds {{number of weeks}}. Must be very short, like 1 or 2 "
@"characters, The space is intentionally omitted between the text and the embedded duration so that "
@"we get, e.g. '5w' not '5 w'. See other *_TIME_AMOUNT strings");
} else {
amountFormat = NSLocalizedString(@"TIME_AMOUNT_WEEKS",
@"{{number of weeks}}, embedded in strings, e.g. 'Alice updated disappearing messages "
@"expiration to {{5 weeks}}'. See other *_TIME_AMOUNT strings");
}
duration = durationSeconds / secondsPerWeek;
}
return [NSString stringWithFormat:amountFormat,
[NSNumberFormatter localizedStringFromNumber:@(duration) numberStyle:NSNumberFormatterNoStyle]];
}
- (NSString *)removeAllCharactersIn:(NSCharacterSet *)characterSet
{
OWSAssertDebug(characterSet);
return [[self componentsSeparatedByCharactersInSet:characterSet] componentsJoinedByString:@""];
}
- (NSString *)digitsOnly
{
return [self removeAllCharactersIn:[NSCharacterSet.decimalDigitCharacterSet invertedSet]];
}
@end
NS_ASSUME_NONNULL_END

View File

@ -1,210 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSLogs.h"
NS_ASSUME_NONNULL_BEGIN
#ifndef OWSAssert
#define CONVERT_TO_STRING(X) #X
#define CONVERT_EXPR_TO_STRING(X) CONVERT_TO_STRING(X)
#ifdef DEBUG
#define USE_ASSERTS
// OWSAssertDebug() and OWSFailDebug() should be used in Obj-C methods.
// OWSCAssertDebug() and OWSCFailDebug() should be used in free functions.
#define OWSAssertDebug(X) \
do { \
if (!(X)) { \
OWSLogError(@"Assertion failed: %s", CONVERT_EXPR_TO_STRING(X)); \
OWSLogFlush(); \
NSAssert(0, @"Assertion failed: %s", CONVERT_EXPR_TO_STRING(X)); \
} \
} while (NO)
#define OWSCAssertDebug(X) \
do { \
if (!(X)) { \
OWSLogError(@"Assertion failed: %s", CONVERT_EXPR_TO_STRING(X)); \
OWSLogFlush(); \
NSCAssert(0, @"Assertion failed: %s", CONVERT_EXPR_TO_STRING(X)); \
} \
} while (NO)
#define OWSFailWithoutLogging(message, ...) \
do { \
NSString *formattedMessage = [NSString stringWithFormat:message, ##__VA_ARGS__]; \
NSAssert(0, formattedMessage); \
} while (NO)
#define OWSCFailWithoutLogging(message, ...) \
do { \
NSString *formattedMessage = [NSString stringWithFormat:message, ##__VA_ARGS__]; \
NSCAssert(0, formattedMessage); \
} while (NO)
#define OWSFailNoFormat(message) \
do { \
OWSLogError(@"%@", message); \
OWSLogFlush(); \
NSAssert(0, message); \
} while (NO)
#define OWSCFailNoFormat(message) \
do { \
OWSLogError(@"%@", message); \
OWSLogFlush(); \
NSCAssert(0, message); \
} while (NO)
#else
#define OWSAssertDebug(X)
#define OWSCAssertDebug(X)
#define OWSFailWithoutLogging(message, ...)
#define OWSCFailWithoutLogging(message, ...)
#define OWSFailNoFormat(X)
#define OWSCFailNoFormat(X)
#endif
#endif
// Like OWSAssertDebug, but will fail in production, terminating the app
#define OWSAssert(X) \
do { \
if (!(X)) { \
OWSFail(@"Assertion failed: %s", CONVERT_EXPR_TO_STRING(X)); \
} \
} while (NO)
#define OWSCAssert(X) \
do { \
if (!(X)) { \
OWSCFail(@"Assertion failed: %s", CONVERT_EXPR_TO_STRING(X)); \
} \
} while (NO)
#define OWSAbstractMethod() OWSFail(@"Method needs to be implemented by subclasses.")
// This macro is intended for use in Objective-C.
#define OWSAssertIsOnMainThread() OWSCAssertDebug([NSThread isMainThread])
#define OWSFailDebug(_messageFormat, ...) \
do { \
OWSLogError(_messageFormat, ##__VA_ARGS__); \
OWSLogFlush(); \
OWSFailWithoutLogging(_messageFormat, ##__VA_ARGS__); \
} while (0)
#define OWSCFailDebug(_messageFormat, ...) \
do { \
OWSLogError(_messageFormat, ##__VA_ARGS__); \
OWSLogFlush(); \
OWSCFailWithoutLogging(_messageFormat, ##__VA_ARGS__); \
} while (NO)
void SwiftExit(NSString *message, const char *file, const char *function, int line);
#define OWSFail(_messageFormat, ...) \
do { \
OWSFailDebug(_messageFormat, ##__VA_ARGS__); \
\
NSString *_message = [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]; \
SwiftExit(_message, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
} while (0)
#define OWSCFail(_messageFormat, ...) \
do { \
OWSCFailDebug(_messageFormat, ##__VA_ARGS__); \
\
NSString *_message = [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]; \
SwiftExit(_message, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
} while (NO)
// Avoids Clang analyzer warning:
// Value stored to 'x' during it's initialization is never read
#define SUPPRESS_DEADSTORE_WARNING(x) \
do { \
(void)x; \
} while (0)
__attribute__((annotate("returns_localized_nsstring"))) static inline NSString *LocalizationNotNeeded(NSString *s)
{
return s;
}
#define OWSGuardWithException(X, ExceptionName) \
do { \
if (!(X)) { \
OWSRaiseException(ExceptionName, @"Guard failed: %s", CONVERT_EXPR_TO_STRING(X)); \
} \
} while (NO)
#define OWSRaiseException(name, formatParam, ...) \
do { \
OWSLogError(@"Exception: %@ %@", name, [NSString stringWithFormat:formatParam, ##__VA_ARGS__]); \
OWSLogFlush(); \
@throw [NSException exceptionWithName:name \
reason:[NSString stringWithFormat:formatParam, ##__VA_ARGS__] \
userInfo:nil]; \
} while (NO)
#define OWSRaiseExceptionWithUserInfo(name, userInfoParam, formatParam, ...) \
do { \
OWSLogError( \
@"Exception: %@ %@ %@", name, userInfoParam, [NSString stringWithFormat:formatParam, ##__VA_ARGS__]); \
OWSLogFlush(); \
@throw [NSException exceptionWithName:name \
reason:[NSString stringWithFormat:formatParam, ##__VA_ARGS__] \
userInfo:userInfoParam]; \
} while (NO)
// UI JANK
//
// In pursuit of smooth UI, we want to continue moving blocking operations off the main thread.
// Add `OWSJanksUI` in code paths that shouldn't be called on the main thread.
// Because we have pervasively broken this tenant, enabling it by default would be too disruptive
// but it's helpful while unjanking and maybe someday we can have it enabled by default.
//#define DEBUG_UI_JANK 1
#ifdef DEBUG
#ifdef DEBUG_UI_JANK
#define OWSJanksUI() \
do { \
OWSAssertDebug(![NSThread isMainThread]) \
} while (NO)
#endif
#endif
#ifndef OWSJanksUI
#define OWSJanksUI()
#endif
#pragma mark - Overflow Math
#define ows_add_overflow(a, b, resultRef) \
do { \
BOOL _didOverflow = __builtin_add_overflow(a, b, resultRef); \
OWSAssert(!_didOverflow); \
} while (NO)
#define ows_sub_overflow(a, b, resultRef) \
do { \
BOOL _didOverflow = __builtin_sub_overflow(a, b, resultRef); \
OWSAssert(!_didOverflow); \
} while (NO)
#define ows_mul_overflow(a, b, resultRef) \
do { \
BOOL _didOverflow = __builtin_mul_overflow(a, b, resultRef); \
OWSAssert(!_didOverflow); \
} while (NO)
NS_ASSUME_NONNULL_END

View File

@ -1,17 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSAsserts.h"
#import <SessionProtocolKit/SessionProtocolKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
void SwiftExit(NSString *message, const char *file, const char *function, int line)
{
NSString *_file = [NSString stringWithFormat:@"%s", file];
NSString *_function = [NSString stringWithFormat:@"%s", function];
[OWSSwiftUtils owsFail:message file:_file function:_function line:line];
}
NS_ASSUME_NONNULL_END

View File

@ -1,48 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
public enum OWSDataParserError: Error {
case overflow(description : String)
}
// MARK: - OWSDataParser
@objc public class OWSDataParser: NSObject {
private let data: Data
private var cursor: UInt = 0
@objc public init(data: Data) {
self.data = data
}
@objc public func nextData(length: UInt, name: String?=nil) throws -> Data {
guard cursor + length <= data.count else {
guard let name = name else {
throw OWSDataParserError.overflow(description: "\(logTag) invalid data read")
}
throw OWSDataParserError.overflow(description: "\(logTag) invalid data read: \(name)")
}
let endIndex = cursor + length
let result = data.subdata(in: Int(cursor)..<Int(endIndex))
cursor += length
return result
}
public func nextByte(name: String?=nil) throws -> UInt8 {
let subdata = try nextData(length: 1, name: name)
return subdata[0]
}
@objc public func remainder(name: String?=nil) throws -> Data {
return try nextData(length: UInt(data.count) - cursor, name: name)
}
@objc public var isEmpty: Bool {
return data.count == cursor
}
}

View File

@ -1,91 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <CocoaLumberjack/CocoaLumberjack.h>
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
static const NSUInteger ddLogLevel = DDLogLevelAll;
#else
static const NSUInteger ddLogLevel = DDLogLevelInfo;
#endif
static inline BOOL ShouldLogVerbose()
{
return ddLogLevel >= DDLogLevelVerbose;
}
static inline BOOL ShouldLogDebug()
{
return ddLogLevel >= DDLogLevelDebug;
}
static inline BOOL ShouldLogInfo()
{
return ddLogLevel >= DDLogLevelInfo;
}
static inline BOOL ShouldLogWarning()
{
return ddLogLevel >= DDLogLevelWarning;
}
static inline BOOL ShouldLogError()
{
return ddLogLevel >= DDLogLevelError;
}
/**
* A minimal DDLog wrapper for swift.
*/
@interface OWSLogger : NSObject
+ (void)verbose:(NSString *)logString;
+ (void)debug:(NSString *)logString;
+ (void)info:(NSString *)logString;
+ (void)warn:(NSString *)logString;
+ (void)error:(NSString *)logString;
+ (void)flush;
@end
#define OWSLogPrefix() \
([NSString stringWithFormat:@"[%@:%d %s]: ", \
[[NSString stringWithUTF8String:__FILE__] lastPathComponent], \
__LINE__, \
__PRETTY_FUNCTION__])
#define OWSLogVerbose(_messageFormat, ...) \
do { \
DDLogVerbose(@"%@%@", OWSLogPrefix(), [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]); \
} while (0)
#define OWSLogDebug(_messageFormat, ...) \
do { \
DDLogDebug(@"%@%@", OWSLogPrefix(), [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]); \
} while (0)
#define OWSLogInfo(_messageFormat, ...) \
do { \
DDLogInfo(@"%@%@", OWSLogPrefix(), [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]); \
} while (0)
#define OWSLogWarn(_messageFormat, ...) \
do { \
DDLogWarn(@"%@%@", OWSLogPrefix(), [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]); \
} while (0)
#define OWSLogError(_messageFormat, ...) \
do { \
DDLogError(@"%@%@", OWSLogPrefix(), [NSString stringWithFormat:_messageFormat, ##__VA_ARGS__]); \
} while (0)
#define OWSLogFlush() \
do { \
[DDLog flushLog]; \
} while (0)
NS_ASSUME_NONNULL_END

View File

@ -1,43 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSLogs.h"
NS_ASSUME_NONNULL_BEGIN
@implementation OWSLogger
+ (void)verbose:(NSString *)logString
{
DDLogVerbose(@"%@", logString);
}
+ (void)debug:(NSString *)logString
{
DDLogDebug(@"%@", logString);
}
+ (void)info:(NSString *)logString
{
DDLogInfo(@"%@", logString);
}
+ (void)warn:(NSString *)logString
{
DDLogWarn(@"%@", logString);
}
+ (void)error:(NSString *)logString
{
DDLogError(@"%@", logString);
}
+ (void)flush
{
OWSLogFlush();
}
@end
NS_ASSUME_NONNULL_END

View File

@ -1,70 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
/**
* We synchronize access to state in this class using this queue.
*/
public func assertOnQueue(_ queue: DispatchQueue) {
if #available(iOS 10.0, *) {
dispatchPrecondition(condition: .onQueue(queue))
} else {
// Skipping check on <iOS10, since syntax is different and it's just a development convenience.
}
}
// Once we're on Swift4.2 we can mark this as inlineable
// @inlinable
public func AssertIsOnMainThread(file: String = #file,
function: String = #function,
line: Int = #line) {
if !Thread.isMainThread {
owsFailDebug("Must be on main thread.", file: file, function: function, line: line)
}
}
// Once we're on Swift4.2 we can mark this as inlineable
// @inlinable
public func owsFailDebug(_ logMessage: String,
file: String = #file,
function: String = #function,
line: Int = #line) {
Logger.error(logMessage, file: file, function: function, line: line)
Logger.flush()
let formattedMessage = owsFormatLogMessage(logMessage, file: file, function: function, line: line)
assertionFailure(formattedMessage)
}
// Once we're on Swift4.2 we can mark this as inlineable
// @inlinable
public func owsFail(_ logMessage: String,
file: String = #file,
function: String = #function,
line: Int = #line) -> Never {
owsFailDebug(logMessage, file: file, function: function, line: line)
let formattedMessage = owsFormatLogMessage(logMessage, file: file, function: function, line: line)
fatalError(formattedMessage)
}
// Once we're on Swift4.2 we can mark this as inlineable
// @inlinable
public func notImplemented(file: String = #file,
function: String = #function,
line: Int = #line) -> Never {
owsFail("Method not implemented.", file: file, function: function, line: line)
}
@objc public class OWSSwiftUtils: NSObject {
// This method can be invoked from Obj-C to exit the app.
@objc public class func owsFail(_ logMessage: String,
file: String = #file,
function: String = #function,
line: Int = #line) -> Never {
owsFailDebug(logMessage, file: file, function: function, line: line)
let formattedMessage = owsFormatLogMessage(logMessage, file: file, function: function, line: line)
fatalError(formattedMessage)
}
}

View File

@ -1,95 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSErrorDomain const SCKExceptionWrapperErrorDomain;
typedef NS_ERROR_ENUM(SCKExceptionWrapperErrorDomain, SCKExceptionWrapperError) {
SCKExceptionWrapperErrorThrown = 900
};
extern NSErrorUserInfoKey const SCKExceptionWrapperUnderlyingExceptionKey;
NSError *SCKExceptionWrapperErrorMake(NSException *exception);
/// Naming conventions:
///
/// Every objc method that can throw an exception should be prefixed with `throws_`.
/// e.g. `throws_foo` and `throws_fooWithBar:bar`
///
/// Every objc method that *calls* an uncaught `throws_` method can throw an exception,
/// so transitively, it should be a `throws_method`
///
/// WRONG!:
///
/// -(void)bar
/// {
/// [foo throws_foo];
/// }
///
/// RIGHT!:
///
/// -(void)throws_bar
/// {
/// [foo throws_foo];
/// }
///
/// WRONG!:
///
/// -(void)throws_bar
/// {
/// @try {
/// [foo throws_foo];
/// } @catch(NSException *exception) {
/// // all exceptions are caught,
/// // so bar doesn't throw.
/// [self doSomethingElse];
/// }
/// }
///
/// RIGHT!:
///
/// -(void)bar
/// {
/// @try {
/// [foo throws_foo];
/// } @catch(NSException *exception) {
/// // all exceptions are caught,
/// // so bar doesn't throw.
/// [self doSomethingElse];
/// }
/// }
///
/// Since initializers must start with the word `init`, an initializer which throws is labeled
/// somewhat awkwardly as: `init_throws_foo` or `init_throws_withFoo:`
///
///
/// Any method that can throw an objc exception must not be called from swift, so must be marked
/// as NS_SWIFT_UNAVAILABLE("some helpful comment or alternative"). When appropriate, provide a
/// Swift safe wrapper using SCKExceptionWrapper.
///
///
/// -(BOOL)barAndReturnError:(NSError **)outError
/// {
/// return [SCKExceptionWrapper tryBlock:^{ [self throws_bar]; }
/// error:outError];
/// }
///
/// -(void)throws_bar
/// {
/// [foo throws_foo];
/// }
NS_SWIFT_UNAVAILABLE("throws objc exceptions")
@interface SCKExceptionWrapper: NSObject
+ (BOOL)tryBlock:(void (^)(void))block error:(NSError **)outError;
@end
void SCKRaiseIfExceptionWrapperError(NSError *_Nullable error) NS_SWIFT_UNAVAILABLE("throws objc exceptions");
NS_ASSUME_NONNULL_END

View File

@ -1,46 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "SCKExceptionWrapper.h"
#import <SessionProtocolKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN
NSErrorDomain const SCKExceptionWrapperErrorDomain = @"SignalCoreKit.SCKExceptionWrapper";
NSErrorUserInfoKey const SCKExceptionWrapperUnderlyingExceptionKey = @"SCKExceptionWrapperUnderlyingException";
NSError *SCKExceptionWrapperErrorMake(NSException *exception)
{
return [NSError errorWithDomain:SCKExceptionWrapperErrorDomain
code:SCKExceptionWrapperErrorThrown
userInfo:@{ SCKExceptionWrapperUnderlyingExceptionKey : exception }];
}
@implementation SCKExceptionWrapper
+ (BOOL)tryBlock:(void (^)(void))block error:(NSError **)outError
{
OWSAssertDebug(outError);
@try {
block();
return YES;
} @catch (NSException *exception) {
*outError = SCKExceptionWrapperErrorMake(exception);
return NO;
}
}
@end
void SCKRaiseIfExceptionWrapperError(NSError *_Nullable error)
{
if (error && [error.domain isEqualToString:SCKExceptionWrapperErrorDomain]
&& error.code == SCKExceptionWrapperErrorThrown) {
NSException *_Nullable exception = error.userInfo[SCKExceptionWrapperUnderlyingExceptionKey];
OWSCAssert(exception);
@throw exception;
}
}
NS_ASSUME_NONNULL_END

View File

@ -4,7 +4,7 @@
#import "SerializationUtilities.h"
#import <CommonCrypto/CommonCrypto.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SignalCoreKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -1,72 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Foundation
@objc
public extension NSString {
func ows_truncated(toByteCount byteCount: UInt) -> NSString? {
return (self as String).truncated(toByteCount: byteCount) as NSString?
}
}
public extension String {
var stripped: String {
return (self as NSString).ows_stripped()
}
var filterForDisplay: String? {
return (self as NSString).filterStringForDisplay()
}
// Truncates string to be less than or equal to byteCount, while ensuring we never truncate partial characters for multibyte characters.
func truncated(toByteCount byteCount: UInt) -> String? {
var lowerBoundCharCount = 0
var upperBoundCharCount = self.count
while (lowerBoundCharCount < upperBoundCharCount) {
guard let upperBoundData = self.prefix(upperBoundCharCount).data(using: .utf8) else {
owsFailDebug("upperBoundData was unexpectedly nil")
return nil
}
if upperBoundData.count <= byteCount {
break
}
// converge
if upperBoundCharCount - lowerBoundCharCount == 1 {
upperBoundCharCount = lowerBoundCharCount
break
}
let midpointCharCount = (lowerBoundCharCount + upperBoundCharCount) / 2
let midpointString = self.prefix(midpointCharCount)
guard let midpointData = midpointString.data(using: .utf8) else {
owsFailDebug("midpointData was unexpectedly nil")
return nil
}
let midpointByteCount = midpointData.count
if midpointByteCount < byteCount {
lowerBoundCharCount = midpointCharCount
} else {
upperBoundCharCount = midpointCharCount
}
}
return String(self.prefix(upperBoundCharCount))
}
func replaceCharacters(characterSet: CharacterSet, replacement: String) -> String {
let components = self.components(separatedBy: characterSet)
return components.joined(separator: replacement)
}
func removeCharacters(characterSet: CharacterSet) -> String {
let components = self.components(separatedBy: characterSet)
return components.joined()
}
}

View File

@ -1,19 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// The block is executed immediately if called from the
// main thread; otherwise it is dispatched async to the
// main thread.
void DispatchMainThreadSafe(dispatch_block_t block);
// The block is executed immediately if called from the
// main thread; otherwise it is dispatched sync to the
// main thread.
void DispatchSyncMainThreadSafe(dispatch_block_t block);
NS_ASSUME_NONNULL_END

View File

@ -1,36 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "Threading.h"
#import <SessionProtocolKit/OWSAsserts.h>
NS_ASSUME_NONNULL_BEGIN
void DispatchMainThreadSafe(dispatch_block_t block)
{
OWSCAssertDebug(block);
if ([NSThread isMainThread]) {
block();
} else {
dispatch_async(dispatch_get_main_queue(), ^{
block();
});
}
}
void DispatchSyncMainThreadSafe(dispatch_block_t block)
{
OWSCAssertDebug(block);
if ([NSThread isMainThread]) {
block();
} else {
dispatch_sync(dispatch_get_main_queue(), ^{
block();
});
}
}
NS_ASSUME_NONNULL_END

View File

@ -1,8 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <Availability.h>
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(major, minor) \
([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = major, .minorVersion = minor, .patchVersion = 0}])

View File

@ -8,9 +8,9 @@
// Separate iOS Frameworks from other imports.
#import "SAEScreenLockViewController.h"
#import "ShareAppExtensionContext.h"
#import <SessionProtocolKit/NSObject+OWS.h>
#import <SessionProtocolKit/OWSAsserts.h>
#import <SessionProtocolKit/OWSLogs.h>
#import <SignalCoreKit/NSObject+OWS.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalCoreKit/OWSLogs.h>
#import <SignalUtilitiesKit/DebugLogger.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSContactsManager.h>

View File

@ -15,7 +15,7 @@
static const NSUInteger ddLogLevel = DDLogLevelInfo;
#endif
#import <SessionProtocolKit/OWSAsserts.h>
#import <SessionProtocolKit/NSObject+OWS.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalCoreKit/NSObject+OWS.h>
#import <SessionUIKit/SessionUIKit.h>
#endif

View File

@ -55,15 +55,13 @@ public enum AESGCM {
#endif
}
let x25519PublicKey = Data(hex: hexEncodedX25519PublicKey)
guard let ephemeralKeyPair = Curve25519.generateKeyPair() else {
throw Error.keyPairGenerationFailed
}
guard let ephemeralSharedSecret = Curve25519.generateSharedSecret(fromPublicKey: x25519PublicKey, andKeyPair: ephemeralKeyPair) else {
let ephemeralKeyPair = Curve25519.generateKeyPair()
guard let ephemeralSharedSecret = try? Curve25519.generateSharedSecret(fromPublicKey: x25519PublicKey, privateKey: ephemeralKeyPair.privateKey) else {
throw Error.sharedSecretGenerationFailed
}
let salt = "LOKI"
let symmetricKey = try HMAC(key: salt.bytes, variant: .sha256).authenticate(ephemeralSharedSecret.bytes)
let ciphertext = try encrypt(plaintext, with: Data(symmetricKey))
return EncryptionResult(ciphertext: ciphertext, symmetricKey: Data(symmetricKey), ephemeralPublicKey: ephemeralKeyPair.publicKey())
return EncryptionResult(ciphertext: ciphertext, symmetricKey: Data(symmetricKey), ephemeralPublicKey: ephemeralKeyPair.publicKey)
}
}

View File

@ -28,8 +28,7 @@ public final class DiffieHellman : NSObject {
}
public static func encrypt(_ plaintext: Data, publicKey: Data, privateKey: Data) throws -> Data {
let keyPair = ECKeyPair(publicKey: publicKey, privateKey: privateKey)
guard let symmetricKey = Curve25519.generateSharedSecret(fromPublicKey: publicKey, andKeyPair: keyPair) else { throw Error.sharedSecretGenerationFailed }
guard let symmetricKey = try? Curve25519.generateSharedSecret(fromPublicKey: publicKey, privateKey: privateKey) else { throw Error.sharedSecretGenerationFailed }
return try encrypt(plaintext, using: symmetricKey)
}
@ -44,8 +43,7 @@ public final class DiffieHellman : NSObject {
}
public static func decrypt(_ ivAndCiphertext: Data, publicKey: Data, privateKey: Data) throws -> Data {
let keyPair = ECKeyPair(publicKey: publicKey, privateKey: privateKey)
guard let symmetricKey = Curve25519.generateSharedSecret(fromPublicKey: publicKey, andKeyPair: keyPair) else { throw Error.sharedSecretGenerationFailed }
guard let symmetricKey = try? Curve25519.generateSharedSecret(fromPublicKey: publicKey, privateKey: privateKey) else { throw Error.sharedSecretGenerationFailed }
return try decrypt(ivAndCiphertext, using: symmetricKey)
}
}

View File

@ -1,13 +0,0 @@
#import <Foundation/Foundation.h>
#import <Curve25519Kit/Curve25519.h>
NS_ASSUME_NONNULL_BEGIN
@interface ECKeyPair (Utilities)
- (ECKeyPair *)initWithPublicKey:(NSData *)publicKey privateKey:(NSData *)privateKey;
- (NSData *)privateKey;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,22 +0,0 @@
#import "ECKeyPair+Utilities.h"
NS_ASSUME_NONNULL_BEGIN
@implementation ECKeyPair (Utilities)
- (ECKeyPair *)initWithPublicKey:(NSData *)snPublicKey privateKey:(NSData *)snPrivateKey
{
ECKeyPair *keyPair = [[ECKeyPair alloc] init];
[keyPair setValue:snPublicKey forKey:@"publicKey"];
[keyPair setValue:snPrivateKey forKey:@"privateKey"];
return keyPair;
}
- (NSData *)privateKey
{
return [NSData dataWithBytes:self->privateKey length:32];
}
@end
NS_ASSUME_NONNULL_END

View File

@ -3,7 +3,6 @@
FOUNDATION_EXPORT double SessionUtilitiesKitVersionNumber;
FOUNDATION_EXPORT const unsigned char SessionUtilitiesKitVersionString[];
#import <SessionUtilitiesKit/ECKeyPair+Utilities.h>
#import <SessionUtilitiesKit/NSDate+Timestamp.h>
#import <SessionUtilitiesKit/NSTimer+Proxying.h>
#import <SessionUtilitiesKit/TSRequest.h>

View File

@ -783,8 +783,6 @@
C3471ED42555386B00297E91 /* AESGCM.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A5D72553860B00C340D1 /* AESGCM.swift */; };
C3471F4225553A4D00297E91 /* Threading.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3471F4125553A4D00297E91 /* Threading.swift */; };
C3471F4C25553AB000297E91 /* MessageReceiver+Decryption.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3471F4B25553AB000297E91 /* MessageReceiver+Decryption.swift */; };
C3471F5625553E1100297E91 /* ECKeyPair+Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = C3471F5525553DA000297E91 /* ECKeyPair+Utilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3471F6825553E7600297E91 /* ECKeyPair+Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = C3471F6725553E7600297E91 /* ECKeyPair+Utilities.m */; };
C3471FA42555439E00297E91 /* Notification+MessageSender.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3471FA32555439E00297E91 /* Notification+MessageSender.swift */; };
C34C8F7423A7830B00D82669 /* SpaceMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */; };
C352A2F525574B4700338F3E /* Job.swift in Sources */ = {isa = PBXBuildFile; fileRef = C352A2F425574B4700338F3E /* Job.swift */; };
@ -1018,9 +1016,7 @@
C3A71D2925589EBF0043A11F /* SessionRestorationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D2825589EBF0043A11F /* SessionRestorationProtocol.swift */; };
C3A71D3B25589F2B0043A11F /* SessionRestorationStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D3A25589F2B0043A11F /* SessionRestorationStatus.swift */; };
C3A71D5025589FF30043A11F /* SMKUDAccessKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4425589FF10043A11F /* SMKUDAccessKey.swift */; };
C3A71D5125589FF30043A11F /* ECPublicKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4525589FF10043A11F /* ECPublicKey.swift */; };
C3A71D5225589FF30043A11F /* SMKError.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4625589FF10043A11F /* SMKError.swift */; };
C3A71D5325589FF30043A11F /* ECPrivateKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4725589FF10043A11F /* ECPrivateKey.swift */; };
C3A71D5425589FF30043A11F /* NSData+messagePadding.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4825589FF20043A11F /* NSData+messagePadding.m */; };
C3A71D5525589FF30043A11F /* SMKSenderCertificate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4925589FF20043A11F /* SMKSenderCertificate.swift */; };
C3A71D5625589FF30043A11F /* SMKServerCertificate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D4A25589FF20043A11F /* SMKServerCertificate.swift */; };
@ -1148,30 +1144,6 @@
C3C2A96F2553B63C00C340D1 /* NSData+keyVersionByte.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A96B2553B63C00C340D1 /* NSData+keyVersionByte.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9702553B63C00C340D1 /* SerializationUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A96C2553B63C00C340D1 /* SerializationUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9712553B63C00C340D1 /* SerializationUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A96D2553B63C00C340D1 /* SerializationUtilities.m */; };
C3C2A9EF2553B9C400C340D1 /* OWSDataParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9D42553B9C100C340D1 /* OWSDataParser.swift */; };
C3C2A9F02553B9C400C340D1 /* OWSAsserts.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9D52553B9C200C340D1 /* OWSAsserts.m */; };
C3C2A9F12553B9C400C340D1 /* OWSLogs.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9D62553B9C200C340D1 /* OWSLogs.m */; };
C3C2A9F22553B9C400C340D1 /* NSObject+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9D72553B9C200C340D1 /* NSObject+OWS.m */; };
C3C2A9F32553B9C400C340D1 /* String+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9D82553B9C200C340D1 /* String+OWS.swift */; };
C3C2A9F42553B9C400C340D1 /* Threading.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9D92553B9C200C340D1 /* Threading.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9F52553B9C400C340D1 /* NSDate+OWS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9DA2553B9C200C340D1 /* NSDate+OWS.mm */; };
C3C2A9F62553B9C400C340D1 /* Data+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9DB2553B9C200C340D1 /* Data+OWS.swift */; };
C3C2A9F72553B9C400C340D1 /* NSData+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9DC2553B9C200C340D1 /* NSData+OWS.m */; };
C3C2A9F82553B9C400C340D1 /* NSString+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9DD2553B9C200C340D1 /* NSString+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9F92553B9C400C340D1 /* NSData+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9DE2553B9C200C340D1 /* NSData+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9FA2553B9C400C340D1 /* OWSSwiftUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9DF2553B9C200C340D1 /* OWSSwiftUtils.swift */; };
C3C2A9FB2553B9C400C340D1 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9E02553B9C300C340D1 /* Logger.swift */; };
C3C2A9FC2553B9C400C340D1 /* iOSVersions.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9E12553B9C300C340D1 /* iOSVersions.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9FD2553B9C400C340D1 /* SCKExceptionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9E22553B9C300C340D1 /* SCKExceptionWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2A9FE2553B9C400C340D1 /* OWSLogs.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9E32553B9C300C340D1 /* OWSLogs.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2AA002553B9C400C340D1 /* NSDate+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9E52553B9C300C340D1 /* NSDate+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2AA012553B9C400C340D1 /* Threading.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9E62553B9C300C340D1 /* Threading.m */; };
C3C2AA022553B9C400C340D1 /* Cryptography.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9E72553B9C300C340D1 /* Cryptography.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2AA042553B9C400C340D1 /* OWSAsserts.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9E92553B9C300C340D1 /* OWSAsserts.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2AA052553B9C400C340D1 /* SCKExceptionWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9EA2553B9C300C340D1 /* SCKExceptionWrapper.m */; };
C3C2AA072553B9C400C340D1 /* Cryptography.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9EC2553B9C400C340D1 /* Cryptography.m */; };
C3C2AA082553B9C400C340D1 /* NSString+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2A9ED2553B9C400C340D1 /* NSString+OWS.m */; };
C3C2AA092553B9C400C340D1 /* NSObject+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2A9EE2553B9C400C340D1 /* NSObject+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3C2AAC82553C25300C340D1 /* SessionProtocolKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A8622553B41A00C340D1 /* SessionProtocolKit.framework */; };
C3C2AB642553C5FF00C340D1 /* SharedSenderKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2AB632553C5FF00C340D1 /* SharedSenderKeys.swift */; };
C3C2ABD22553C6C900C340D1 /* Data+SecureRandom.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2ABD12553C6C900C340D1 /* Data+SecureRandom.swift */; };
@ -2172,8 +2144,6 @@
C3471ECA2555356A00297E91 /* MessageSender+Encryption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MessageSender+Encryption.swift"; sourceTree = "<group>"; };
C3471F4125553A4D00297E91 /* Threading.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Threading.swift; sourceTree = "<group>"; };
C3471F4B25553AB000297E91 /* MessageReceiver+Decryption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MessageReceiver+Decryption.swift"; sourceTree = "<group>"; };
C3471F5525553DA000297E91 /* ECKeyPair+Utilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ECKeyPair+Utilities.h"; sourceTree = "<group>"; };
C3471F6725553E7600297E91 /* ECKeyPair+Utilities.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "ECKeyPair+Utilities.m"; sourceTree = "<group>"; };
C3471FA32555439E00297E91 /* Notification+MessageSender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+MessageSender.swift"; sourceTree = "<group>"; };
C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SpaceMono-Bold.ttf"; sourceTree = "<group>"; };
C352A2F425574B4700338F3E /* Job.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Job.swift; sourceTree = "<group>"; };
@ -2407,9 +2377,7 @@
C3A71D2825589EBF0043A11F /* SessionRestorationProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionRestorationProtocol.swift; sourceTree = "<group>"; };
C3A71D3A25589F2B0043A11F /* SessionRestorationStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionRestorationStatus.swift; sourceTree = "<group>"; };
C3A71D4425589FF10043A11F /* SMKUDAccessKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMKUDAccessKey.swift; sourceTree = "<group>"; };
C3A71D4525589FF10043A11F /* ECPublicKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ECPublicKey.swift; sourceTree = "<group>"; };
C3A71D4625589FF10043A11F /* SMKError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMKError.swift; sourceTree = "<group>"; };
C3A71D4725589FF10043A11F /* ECPrivateKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ECPrivateKey.swift; sourceTree = "<group>"; };
C3A71D4825589FF20043A11F /* NSData+messagePadding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+messagePadding.m"; sourceTree = "<group>"; };
C3A71D4925589FF20043A11F /* SMKSenderCertificate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMKSenderCertificate.swift; sourceTree = "<group>"; };
C3A71D4A25589FF20043A11F /* SMKServerCertificate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMKServerCertificate.swift; sourceTree = "<group>"; };
@ -2544,30 +2512,6 @@
C3C2A96B2553B63C00C340D1 /* NSData+keyVersionByte.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+keyVersionByte.h"; path = "Utility/NSData+keyVersionByte.h"; sourceTree = "<group>"; };
C3C2A96C2553B63C00C340D1 /* SerializationUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SerializationUtilities.h; path = Utility/SerializationUtilities.h; sourceTree = "<group>"; };
C3C2A96D2553B63C00C340D1 /* SerializationUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SerializationUtilities.m; path = Utility/SerializationUtilities.m; sourceTree = "<group>"; };
C3C2A9D42553B9C100C340D1 /* OWSDataParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSDataParser.swift; path = Utility/OWSDataParser.swift; sourceTree = "<group>"; };
C3C2A9D52553B9C200C340D1 /* OWSAsserts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSAsserts.m; path = Utility/OWSAsserts.m; sourceTree = "<group>"; };
C3C2A9D62553B9C200C340D1 /* OWSLogs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSLogs.m; path = Utility/OWSLogs.m; sourceTree = "<group>"; };
C3C2A9D72553B9C200C340D1 /* NSObject+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+OWS.m"; path = "Utility/NSObject+OWS.m"; sourceTree = "<group>"; };
C3C2A9D82553B9C200C340D1 /* String+OWS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+OWS.swift"; path = "Utility/String+OWS.swift"; sourceTree = "<group>"; };
C3C2A9D92553B9C200C340D1 /* Threading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Threading.h; path = Utility/Threading.h; sourceTree = "<group>"; };
C3C2A9DA2553B9C200C340D1 /* NSDate+OWS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "NSDate+OWS.mm"; path = "Utility/NSDate+OWS.mm"; sourceTree = "<group>"; };
C3C2A9DB2553B9C200C340D1 /* Data+OWS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Data+OWS.swift"; path = "Utility/Data+OWS.swift"; sourceTree = "<group>"; };
C3C2A9DC2553B9C200C340D1 /* NSData+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSData+OWS.m"; path = "Utility/NSData+OWS.m"; sourceTree = "<group>"; };
C3C2A9DD2553B9C200C340D1 /* NSString+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+OWS.h"; path = "Utility/NSString+OWS.h"; sourceTree = "<group>"; };
C3C2A9DE2553B9C200C340D1 /* NSData+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+OWS.h"; path = "Utility/NSData+OWS.h"; sourceTree = "<group>"; };
C3C2A9DF2553B9C200C340D1 /* OWSSwiftUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSSwiftUtils.swift; path = Utility/OWSSwiftUtils.swift; sourceTree = "<group>"; };
C3C2A9E02553B9C300C340D1 /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Logger.swift; path = Utility/Logger.swift; sourceTree = "<group>"; };
C3C2A9E12553B9C300C340D1 /* iOSVersions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iOSVersions.h; path = Utility/iOSVersions.h; sourceTree = "<group>"; };
C3C2A9E22553B9C300C340D1 /* SCKExceptionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SCKExceptionWrapper.h; path = Utility/SCKExceptionWrapper.h; sourceTree = "<group>"; };
C3C2A9E32553B9C300C340D1 /* OWSLogs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSLogs.h; path = Utility/OWSLogs.h; sourceTree = "<group>"; };
C3C2A9E52553B9C300C340D1 /* NSDate+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDate+OWS.h"; path = "Utility/NSDate+OWS.h"; sourceTree = "<group>"; };
C3C2A9E62553B9C300C340D1 /* Threading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Threading.m; path = Utility/Threading.m; sourceTree = "<group>"; };
C3C2A9E72553B9C300C340D1 /* Cryptography.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Cryptography.h; path = Utility/Cryptography.h; sourceTree = "<group>"; };
C3C2A9E92553B9C300C340D1 /* OWSAsserts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSAsserts.h; path = Utility/OWSAsserts.h; sourceTree = "<group>"; };
C3C2A9EA2553B9C300C340D1 /* SCKExceptionWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SCKExceptionWrapper.m; path = Utility/SCKExceptionWrapper.m; sourceTree = "<group>"; };
C3C2A9EC2553B9C400C340D1 /* Cryptography.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Cryptography.m; path = Utility/Cryptography.m; sourceTree = "<group>"; };
C3C2A9ED2553B9C400C340D1 /* NSString+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+OWS.m"; path = "Utility/NSString+OWS.m"; sourceTree = "<group>"; };
C3C2A9EE2553B9C400C340D1 /* NSObject+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+OWS.h"; path = "Utility/NSObject+OWS.h"; sourceTree = "<group>"; };
C3C2AB632553C5FF00C340D1 /* SharedSenderKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedSenderKeys.swift; sourceTree = "<group>"; };
C3C2ABD12553C6C900C340D1 /* Data+SecureRandom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+SecureRandom.swift"; sourceTree = "<group>"; };
C3C2ABE32553C74400C340D1 /* ClosedGroupRatchet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClosedGroupRatchet.swift; sourceTree = "<group>"; };
@ -4065,8 +4009,6 @@
C3A71DB12558B25F0043A11F /* Metadata */ = {
isa = PBXGroup;
children = (
C3A71D4725589FF10043A11F /* ECPrivateKey.swift */,
C3A71D4525589FF10043A11F /* ECPublicKey.swift */,
C3A71D4E25589FF30043A11F /* NSData+messagePadding.h */,
C3A71D4825589FF20043A11F /* NSData+messagePadding.m */,
C3A71D4B25589FF20043A11F /* SMKCertificateValidator.swift */,
@ -4168,8 +4110,6 @@
C3C2ABD12553C6C900C340D1 /* Data+SecureRandom.swift */,
C3C2A5D52553860A00C340D1 /* Dictionary+Description.swift */,
C3A71D662558A0170043A11F /* DiffieHellman.swift */,
C3471F5525553DA000297E91 /* ECKeyPair+Utilities.h */,
C3471F6725553E7600297E91 /* ECKeyPair+Utilities.m */,
C3C2A5BC255385EE00C340D1 /* HTTP.swift */,
C3C2A5D92553860B00C340D1 /* JSON.swift */,
C3C2A5CE2553860700C340D1 /* Logging.swift */,
@ -4370,34 +4310,10 @@
C3C2A9692553B62B00C340D1 /* Utility */ = {
isa = PBXGroup;
children = (
C3C2A9E72553B9C300C340D1 /* Cryptography.h */,
C3C2A9EC2553B9C400C340D1 /* Cryptography.m */,
C3C2A9DB2553B9C200C340D1 /* Data+OWS.swift */,
C3C2A9E12553B9C300C340D1 /* iOSVersions.h */,
C3C2A9E02553B9C300C340D1 /* Logger.swift */,
C3C2A96B2553B63C00C340D1 /* NSData+keyVersionByte.h */,
C3C2A96A2553B63B00C340D1 /* NSData+keyVersionByte.m */,
C3C2A9DE2553B9C200C340D1 /* NSData+OWS.h */,
C3C2A9DC2553B9C200C340D1 /* NSData+OWS.m */,
C3C2A9E52553B9C300C340D1 /* NSDate+OWS.h */,
C3C2A9DA2553B9C200C340D1 /* NSDate+OWS.mm */,
C3C2A9EE2553B9C400C340D1 /* NSObject+OWS.h */,
C3C2A9D72553B9C200C340D1 /* NSObject+OWS.m */,
C3C2A9DD2553B9C200C340D1 /* NSString+OWS.h */,
C3C2A9ED2553B9C400C340D1 /* NSString+OWS.m */,
C3C2A9E92553B9C300C340D1 /* OWSAsserts.h */,
C3C2A9D52553B9C200C340D1 /* OWSAsserts.m */,
C3C2A9D42553B9C100C340D1 /* OWSDataParser.swift */,
C3C2A9E32553B9C300C340D1 /* OWSLogs.h */,
C3C2A9D62553B9C200C340D1 /* OWSLogs.m */,
C3C2A9DF2553B9C200C340D1 /* OWSSwiftUtils.swift */,
C3C2A9E22553B9C300C340D1 /* SCKExceptionWrapper.h */,
C3C2A9EA2553B9C300C340D1 /* SCKExceptionWrapper.m */,
C3C2A96C2553B63C00C340D1 /* SerializationUtilities.h */,
C3C2A96D2553B63C00C340D1 /* SerializationUtilities.m */,
C3C2A9D82553B9C200C340D1 /* String+OWS.swift */,
C3C2A9D92553B9C200C340D1 /* Threading.h */,
C3C2A9E62553B9C300C340D1 /* Threading.m */,
);
name = Utility;
sourceTree = "<group>";
@ -4809,7 +4725,6 @@
C352A3B72557B6ED00338F3E /* TSRequest.h in Headers */,
C300A63B2554B72200555489 /* NSDate+Timestamp.h in Headers */,
C352A3772557864000338F3E /* NSTimer+Proxying.h in Headers */,
C3471F5625553E1100297E91 /* ECKeyPair+Utilities.h in Headers */,
C3C2A67D255388CC00C340D1 /* SessionUtilitiesKit.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -4826,7 +4741,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
C3C2AA092553B9C400C340D1 /* NSObject+OWS.h in Headers */,
C3C2A95E2553B62400C340D1 /* IdentityKeyStore.h in Headers */,
C3C2A95D2553B62400C340D1 /* PreKeyStore.h in Headers */,
C3C2A91F2553B5B200C340D1 /* AxolotlParameters.h in Headers */,
@ -4834,19 +4748,15 @@
C3C2A8D52553B57C00C340D1 /* PreKeyBundle.h in Headers */,
C3C2A9092553B5B200C340D1 /* RatchetingSession.h in Headers */,
C3C2A96F2553B63C00C340D1 /* NSData+keyVersionByte.h in Headers */,
C3C2A9FC2553B9C400C340D1 /* iOSVersions.h in Headers */,
C3C2A91D2553B5B200C340D1 /* AliceAxolotlParameters.h in Headers */,
C3C2A9402553B5D700C340D1 /* SessionRecord.h in Headers */,
C3C2A9F42553B9C400C340D1 /* Threading.h in Headers */,
C3C2A90A2553B5B200C340D1 /* Chain.h in Headers */,
C3C2A8882553B4CC00C340D1 /* AxolotlExceptions.h in Headers */,
C3A71D5A25589FF30043A11F /* NSData+messagePadding.h in Headers */,
C3C2A89E2553B4F600C340D1 /* WhisperMessage.h in Headers */,
C3C2A8D92553B57C00C340D1 /* PreKeyRecord.h in Headers */,
C3C2A90B2553B5B200C340D1 /* MessageKeys.h in Headers */,
C3C2AA022553B9C400C340D1 /* Cryptography.h in Headers */,
C3C2A90C2553B5B200C340D1 /* RKCK.h in Headers */,
C3C2AA042553B9C400C340D1 /* OWSAsserts.h in Headers */,
C3C2A92B2553B5BE00C340D1 /* SessionCipher.h in Headers */,
C3C2A9152553B5B200C340D1 /* BobAxolotlParameters.h in Headers */,
C3C2A9412553B5D700C340D1 /* SessionState.h in Headers */,
@ -4855,17 +4765,12 @@
C3C2A89F2553B4F600C340D1 /* ClosedGroupCiphertextMessage.h in Headers */,
C3C2A95C2553B62400C340D1 /* AxolotlStore.h in Headers */,
C3C2A9602553B62400C340D1 /* SignedPreKeyStore.h in Headers */,
C3C2A9F82553B9C400C340D1 /* NSString+OWS.h in Headers */,
C3C2A9702553B63C00C340D1 /* SerializationUtilities.h in Headers */,
C3C2A8A42553B4F600C340D1 /* FallbackMessage.h in Headers */,
C3C2A9122553B5B200C340D1 /* ReceivingChain.h in Headers */,
C3C2AA002553B9C400C340D1 /* NSDate+OWS.h in Headers */,
C3C2A9202553B5B200C340D1 /* SendingChain.h in Headers */,
C3C2A89C2553B4F600C340D1 /* PreKeyWhisperMessage.h in Headers */,
C3C2A9FD2553B9C400C340D1 /* SCKExceptionWrapper.h in Headers */,
C3C2A8B62553B53800C340D1 /* Constants.h in Headers */,
C3C2A9FE2553B9C400C340D1 /* OWSLogs.h in Headers */,
C3C2A9F92553B9C400C340D1 /* NSData+OWS.h in Headers */,
C3C2A8C22553B55600C340D1 /* AES-CBC.h in Headers */,
C3C2A93C2553B5D700C340D1 /* SessionBuilder.h in Headers */,
C3C2A9162553B5B200C340D1 /* ChainAndIndex.h in Headers */,
@ -5469,6 +5374,7 @@
"${BUILT_PRODUCTS_DIR}/ZXingObjC/ZXingObjC.framework",
"${BUILT_PRODUCTS_DIR}/Curve25519Kit/Curve25519Kit.framework",
"${PODS_ROOT}/GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework",
"${BUILT_PRODUCTS_DIR}/SignalCoreKit/SignalCoreKit.framework",
"${BUILT_PRODUCTS_DIR}/HKDFKit/HKDFKit.framework",
"${BUILT_PRODUCTS_DIR}/SAMKeychain/SAMKeychain.framework",
"${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework",
@ -5494,6 +5400,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZXingObjC.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Curve25519Kit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SignalCoreKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HKDFKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SAMKeychain.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework",
@ -6090,7 +5997,6 @@
C3C2ABD22553C6C900C340D1 /* Data+SecureRandom.swift in Sources */,
C3A7211A2558BCA10043A11F /* DiffieHellman.swift in Sources */,
C3A7225E2558C38D0043A11F /* AnyPromise+Retaining.swift in Sources */,
C3471F6825553E7600297E91 /* ECKeyPair+Utilities.m in Sources */,
C3BBE0AA2554D4DE0050F1E3 /* Dictionary+Description.swift in Sources */,
C3C2AC2E2553CBEB00C340D1 /* String+Trimming.swift in Sources */,
C352A3A62557B60D00338F3E /* TSRequest.m in Sources */,
@ -6171,49 +6077,34 @@
C3C2A9172553B5B200C340D1 /* RootKey.m in Sources */,
C3C2A9112553B5B200C340D1 /* ChainKey.m in Sources */,
C3C2A8C32553B55600C340D1 /* AES-CBC.m in Sources */,
C3C2AA012553B9C400C340D1 /* Threading.m in Sources */,
C3C2A9F32553B9C400C340D1 /* String+OWS.swift in Sources */,
C3A71D682558A0170043A11F /* LokiSessionCipher.swift in Sources */,
C3C2A9F12553B9C400C340D1 /* OWSLogs.m in Sources */,
C3C2A9F22553B9C400C340D1 /* NSObject+OWS.m in Sources */,
C3A71D5B25589FF30043A11F /* SMKUnidentifiedSenderMessage.swift in Sources */,
C3C2A9182553B5B200C340D1 /* SendingChain.m in Sources */,
C3C2A8A02553B4F600C340D1 /* PreKeyWhisperMessage.m in Sources */,
C3A71D5225589FF30043A11F /* SMKError.swift in Sources */,
C3C2A93F2553B5D700C340D1 /* SessionState.m in Sources */,
C3C2A9F02553B9C400C340D1 /* OWSAsserts.m in Sources */,
C3A71D5125589FF30043A11F /* ECPublicKey.swift in Sources */,
C3C2ABF82553C8A300C340D1 /* Storage.swift in Sources */,
C3C2A9F72553B9C400C340D1 /* NSData+OWS.m in Sources */,
C3C2A90D2553B5B200C340D1 /* RKCK.m in Sources */,
C3C2A8E72553B59B00C340D1 /* SPKProto.swift in Sources */,
C3A71D5325589FF30043A11F /* ECPrivateKey.swift in Sources */,
C3A71D5525589FF30043A11F /* SMKSenderCertificate.swift in Sources */,
C3C2A91E2553B5B200C340D1 /* ChainAndIndex.m in Sources */,
C3C2A91A2553B5B200C340D1 /* TSDerivedSecrets.m in Sources */,
C3A71D5025589FF30043A11F /* SMKUDAccessKey.swift in Sources */,
C3C2A91C2553B5B200C340D1 /* ReceivingChain.m in Sources */,
C3C2A9EF2553B9C400C340D1 /* OWSDataParser.swift in Sources */,
C3C2A8A32553B4F600C340D1 /* FallbackMessage.m in Sources */,
C3A71D5425589FF30043A11F /* NSData+messagePadding.m in Sources */,
C3C2AA072553B9C400C340D1 /* Cryptography.m in Sources */,
C3C2A9F52553B9C400C340D1 /* NSDate+OWS.mm in Sources */,
C3C2ABE42553C74400C340D1 /* ClosedGroupRatchet.swift in Sources */,
C3C2A93E2553B5D700C340D1 /* SessionRecord.m in Sources */,
C3A71D742558A0F60043A11F /* SMKProto.swift in Sources */,
C3C2AA052553B9C400C340D1 /* SCKExceptionWrapper.m in Sources */,
C3A71D2925589EBF0043A11F /* SessionRestorationProtocol.swift in Sources */,
C3C2A8D62553B57C00C340D1 /* PreKeyBundle.m in Sources */,
C3C2A9F62553B9C400C340D1 /* Data+OWS.swift in Sources */,
C3C2A89D2553B4F600C340D1 /* ClosedGroupCiphertextMessage.m in Sources */,
C3C2A9FB2553B9C400C340D1 /* Logger.swift in Sources */,
C3A71D672558A0170043A11F /* FallbackSessionCipher.swift in Sources */,
C3C2AC0A2553C9A100C340D1 /* Configuration.swift in Sources */,
C3C2A96E2553B63C00C340D1 /* NSData+keyVersionByte.m in Sources */,
C3C2A8E62553B59B00C340D1 /* WhisperTextProtocol.pb.swift in Sources */,
C3C2AB642553C5FF00C340D1 /* SharedSenderKeys.swift in Sources */,
C3C2A9102553B5B200C340D1 /* AliceAxolotlParameters.m in Sources */,
C3C2A9FA2553B9C400C340D1 /* OWSSwiftUtils.swift in Sources */,
C3C2A92C2553B5BE00C340D1 /* SessionCipher.m in Sources */,
C3C2A8D42553B57C00C340D1 /* SignedPrekeyRecord.m in Sources */,
C3A71D752558A0F60043A11F /* OWSUnidentifiedDelivery.pb.swift in Sources */,
@ -6223,7 +6114,6 @@
C3C2A90F2553B5B200C340D1 /* RatchetingSession.m in Sources */,
C3A71D5725589FF30043A11F /* SMKCertificateValidator.swift in Sources */,
C3C2A93D2553B5D700C340D1 /* SessionBuilder.m in Sources */,
C3C2AA082553B9C400C340D1 /* NSString+OWS.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

Some files were not shown because too many files have changed in this diff Show More