diff --git a/Noti.xcodeproj/project.pbxproj b/Noti.xcodeproj/project.pbxproj index d2452b3..5780883 100644 --- a/Noti.xcodeproj/project.pbxproj +++ b/Noti.xcodeproj/project.pbxproj @@ -10,8 +10,8 @@ 162B919FE4321ED9BC86AD09 /* Pods_Noti.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2C7615AF577BAEAF32B8516 /* Pods_Noti.framework */; }; 4901D3CF1D1C121D005F1641 /* StatusMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901D3CE1D1C121D005F1641 /* StatusMenuController.swift */; }; 4901D3D31D23E6AB005F1641 /* IntroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901D3D21D23E6AB005F1641 /* IntroViewController.swift */; }; - 498275F01D34E03200AB7029 /* SwCrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498275EF1D34E03200AB7029 /* SwCrypt.swift */; }; 498275F21D35101A00AB7029 /* Crypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498275F11D35101A00AB7029 /* Crypt.swift */; }; + 498275FB1D3567D500AB7029 /* SwCrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498275FA1D3567D500AB7029 /* SwCrypt.swift */; }; 498499FE1D1BE46F007FC963 /* PushManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498499FD1D1BE46F007FC963 /* PushManager.swift */; }; 499DD0F61D2ACA0B00BB759D /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 499DD0F51D2ACA0B00BB759D /* .gitignore */; }; 499DD0F81D2D7BBF00BB759D /* Ephemerals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 499DD0F71D2D7BBF00BB759D /* Ephemerals.swift */; }; @@ -27,9 +27,9 @@ 0F7FEC6A353CB04118DDEBF6 /* Pods-Noti.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Noti.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Noti/Pods-Noti.debug.xcconfig"; sourceTree = ""; }; 4901D3CE1D1C121D005F1641 /* StatusMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenuController.swift; sourceTree = ""; }; 4901D3D21D23E6AB005F1641 /* IntroViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroViewController.swift; sourceTree = ""; }; - 498275EE1D34E03200AB7029 /* SwCrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwCrypt.h; sourceTree = ""; }; - 498275EF1D34E03200AB7029 /* SwCrypt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwCrypt.swift; sourceTree = ""; }; 498275F11D35101A00AB7029 /* Crypt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Crypt.swift; sourceTree = ""; }; + 498275F91D3567D500AB7029 /* SwCrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwCrypt.h; sourceTree = ""; }; + 498275FA1D3567D500AB7029 /* SwCrypt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwCrypt.swift; sourceTree = ""; }; 498499FD1D1BE46F007FC963 /* PushManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushManager.swift; sourceTree = ""; }; 499DD0F51D2ACA0B00BB759D /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; 499DD0F71D2D7BBF00BB759D /* Ephemerals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Ephemerals.swift; sourceTree = ""; }; @@ -80,8 +80,8 @@ 49B43B0A1D1ADFB200A24585 /* Noti */ = { isa = PBXGroup; children = ( - 498275EE1D34E03200AB7029 /* SwCrypt.h */, - 498275EF1D34E03200AB7029 /* SwCrypt.swift */, + 498275F91D3567D500AB7029 /* SwCrypt.h */, + 498275FA1D3567D500AB7029 /* SwCrypt.swift */, 49B43B0B1D1ADFB200A24585 /* AppDelegate.swift */, 49B43B0D1D1ADFB200A24585 /* AuthViewController.swift */, 49B43B0F1D1ADFB200A24585 /* Assets.xcassets */, @@ -238,11 +238,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 498275FB1D3567D500AB7029 /* SwCrypt.swift in Sources */, 4901D3D31D23E6AB005F1641 /* IntroViewController.swift in Sources */, 499DD0FC1D2D8FAC00BB759D /* RoundedImage.swift in Sources */, 498499FE1D1BE46F007FC963 /* PushManager.swift in Sources */, 49B43B0E1D1ADFB200A24585 /* AuthViewController.swift in Sources */, - 498275F01D34E03200AB7029 /* SwCrypt.swift in Sources */, 4901D3CF1D1C121D005F1641 /* StatusMenuController.swift in Sources */, 49B43B0C1D1ADFB200A24585 /* AppDelegate.swift in Sources */, 499DD0F81D2D7BBF00BB759D /* Ephemerals.swift in Sources */, diff --git a/Noti.xcworkspace/xcuserdata/Jari.xcuserdatad/xcdebugger/Expressions.xcexplist b/Noti.xcworkspace/xcuserdata/Jari.xcuserdatad/xcdebugger/Expressions.xcexplist index 13a990c..e34e8d1 100644 --- a/Noti.xcworkspace/xcuserdata/Jari.xcuserdatad/xcdebugger/Expressions.xcexplist +++ b/Noti.xcworkspace/xcuserdata/Jari.xcuserdatad/xcdebugger/Expressions.xcexplist @@ -68,6 +68,14 @@ + + + + + + diff --git a/Noti/Crypt.swift b/Noti/Crypt.swift index e89f0ab..7ebe66e 100644 --- a/Noti/Crypt.swift +++ b/Noti/Crypt.swift @@ -7,7 +7,6 @@ // import Foundation -import CryptoSwift public class Crypt { var key: [UInt8]; @@ -16,11 +15,9 @@ public class Crypt { self.key = key } - static func generateKey(password: String, salt: String) -> [UInt8]? { - let password: Array = password.utf8.map {$0} - let salt: Array = salt.utf8.map {$0} - print("Noti is generating a key!") - return try? PKCS5.PBKDF2(password: password, salt: salt, iterations: 30000, keyLength: 32, variant: .sha256).calculate() + static func generateKey(password: String, salt: String) -> NSData? { + print("Generating a new key...") + return try? CC.KeyDerivation.PBKDF2(password, salt: salt.dataUsingEncoding(NSUTF8StringEncoding)!, prf: .sha256, rounds: 30000) } func decryptMessage(cipher: String) -> String? { @@ -28,7 +25,7 @@ public class Crypt { var rawBytes = [UInt8](count: rawData!.length / sizeof(UInt8), repeatedValue: 0) rawData?.getBytes(&rawBytes, length: rawBytes.count) -// let tag = [UInt8](rawBytes[1...16]) + let tag = NSData(bytes: [UInt8](rawBytes[1...16])) let iv = [UInt8](rawBytes[17...28]) let message = [UInt8](rawBytes[29.. 2.3.2' pod 'Alamofire', '~> 3.4.1' pod 'Sparkle', '~> 1.14.0' - pod 'CryptoSwift', '~> 0.5.1' end \ No newline at end of file