diff --git a/ObjectivePGP.h b/ObjectivePGP.h index 0e114aa6730488e0ddee35c850a489e73f399d20..04e8c98f6803346161ba43820b115ea09d2c4de9 100644 --- a/ObjectivePGP.h +++ b/ObjectivePGP.h @@ -59,6 +59,6 @@ - (nullable NSData *) decryptData:(nonnull NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase verifyWithPublicKey:(nullable PGPKey *)publicKey signed:(nullable BOOL*)isSigned valid:(nullable BOOL*)isValid integrityProtected:(nullable BOOL*)isIntegrityProtected error:(NSError * __autoreleasing __nullable * __nullable)error; - (nonnull PGPTemporaryDecryptionObject *) decryptDataFirstPart:(nonnull NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase integrityProtected:(nullable BOOL*)isIntegrityProtected error:(NSError * __autoreleasing __nullable * __nullable)error; -- (BOOL *) decryptDataSecondPart:(nonnull PGPTemporaryDecryptionObject *)temporaryDecryptionObject verifyWithPublicKey:(nullable PGPKey *)publicKey signed:(nullable BOOL*)isSigned valid:(nullable BOOL*)isValid error:(NSError * __autoreleasing __nullable * __nullable)error; +- (BOOL *_Nonnull) decryptDataSecondPart:(nonnull PGPTemporaryDecryptionObject *)temporaryDecryptionObject verifyWithPublicKey:(nullable PGPKey *)publicKey signed:(nullable BOOL*)isSigned valid:(nullable BOOL*)isValid error:(NSError * __autoreleasing __nullable * __nullable)error; @end diff --git a/ObjectivePGP.m b/ObjectivePGP.m index 0429bfe4a5360dd74338fd6ec19d663150fdab26..e8979a8d7245f91185643a38e8f74470740c782e 100644 --- a/ObjectivePGP.m +++ b/ObjectivePGP.m @@ -1005,8 +1005,6 @@ NSData *armoredData = [armoredMessage dataUsingEncoding:NSASCIIStringEncoding]; - //TODO REMOVE - NSString *aString = [[NSString alloc] initWithData:armoredData encoding:NSUTF8StringEncoding]; return [self importKeysFromData: armoredData allowDuplicates:allowDuplicates]; diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index 0475b3fdfad88e2c8b06cf185c1377c04c88d93a..ee7a5f8a944c78134558a70c58632f11095f904f 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -80,12 +80,10 @@ A15B7BE81E2934CB0024E499 /* EncryptionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15B7BE71E2934CB0024E499 /* EncryptionType.swift */; }; A16BA2121E0439B6005E29E3 /* providers.json in Resources */ = {isa = PBXBuildFile; fileRef = A16BA2111E0439B6005E29E3 /* providers.json */; }; A172F90D1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = A172F90C1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift */; }; - A17A06E91E8190C300C8AEF6 /* OnboardingViewCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17A06E81E8190C300C8AEF6 /* OnboardingViewCells.swift */; }; A17A18F71DDCBE530058D934 /* PGPKeyWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17A18F61DDCBE530058D934 /* PGPKeyWrapper.swift */; }; A17A18F91DDCCF370058D934 /* JakobBode.asc in Resources */ = {isa = PBXBuildFile; fileRef = A17A18F81DDCCF370058D934 /* JakobBode.asc */; }; A17BEB391E55E3DD00403EBE /* PGPTemporaryDecryptionObject.m in Sources */ = {isa = PBXBuildFile; fileRef = A17BEB381E55E3DD00403EBE /* PGPTemporaryDecryptionObject.m */; }; A17C04841DC6504E00F66EDB /* LogHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17C04831DC6504E00F66EDB /* LogHandler.swift */; }; - A18C76871E81861C00B21414 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A18C76861E81861C00B21414 /* OnboardingViewController.swift */; }; A19C12471DE602FF007F72E7 /* jabo.asc in Resources */ = {isa = PBXBuildFile; fileRef = A19C12461DE602FF007F72E7 /* jabo.asc */; }; A1B8C01A1DD5D9B10044A358 /* alice2005-2.gpg in Resources */ = {isa = PBXBuildFile; fileRef = A1B8C0191DD5D9B10044A358 /* alice2005-2.gpg */; }; A1BE3FF61E9664660040114B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A1BE3FF81E9664660040114B /* InfoPlist.strings */; }; @@ -113,7 +111,6 @@ A1EB059C1D956957008659C1 /* NSDateCompare.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EB059B1D956957008659C1 /* NSDateCompare.swift */; }; A1EB05A01D95696C008659C1 /* MessageBodyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EB059F1D95696C008659C1 /* MessageBodyTableViewCell.swift */; }; A1EB05A41D956E32008659C1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A1EB05A31D956E32008659C1 /* Assets.xcassets */; }; - A1F1D7E41E83E93D0009CBDF /* SwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1F1D7E31E83E93D0009CBDF /* SwitchCell.xib */; }; A1F2A5691E85586300320275 /* Providers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1F2A5681E85586300320275 /* Providers.swift */; }; A1F992291DA7C9100073BF1B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A1F9922B1DA7C9100073BF1B /* Main.storyboard */; }; A1F992391DA7DD2E0073BF1B /* InboxTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1F9923B1DA7DD2E0073BF1B /* InboxTableViewCell.xib */; }; @@ -273,13 +270,11 @@ A15B7BE71E2934CB0024E499 /* EncryptionType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EncryptionType.swift; sourceTree = "<group>"; }; A16BA2111E0439B6005E29E3 /* providers.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; lineEnding = 0; path = providers.json; sourceTree = "<group>"; }; A172F90C1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PGPTemporaryDecryptionObject.swift; sourceTree = "<group>"; }; - A17A06E81E8190C300C8AEF6 /* OnboardingViewCells.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingViewCells.swift; sourceTree = "<group>"; }; A17A18F61DDCBE530058D934 /* PGPKeyWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PGPKeyWrapper.swift; sourceTree = "<group>"; }; A17A18F81DDCCF370058D934 /* JakobBode.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = JakobBode.asc; sourceTree = "<group>"; }; A17BEB371E55E21700403EBE /* PGPTemporaryDecryptionObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PGPTemporaryDecryptionObject.h; sourceTree = "<group>"; }; A17BEB381E55E3DD00403EBE /* PGPTemporaryDecryptionObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGPTemporaryDecryptionObject.m; sourceTree = "<group>"; }; A17C04831DC6504E00F66EDB /* LogHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogHandler.swift; sourceTree = "<group>"; }; - A18C76861E81861C00B21414 /* OnboardingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; }; A198270D1D9A8ABC0027F65C /* enzevalos_iphone-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "enzevalos_iphone-Bridging-Header.h"; sourceTree = "<group>"; }; A19C12461DE602FF007F72E7 /* jabo.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = jabo.asc; sourceTree = "<group>"; }; A1B8C0191DD5D9B10044A358 /* alice2005-2.gpg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "alice2005-2.gpg"; sourceTree = "<group>"; }; @@ -308,7 +303,6 @@ A1EB059B1D956957008659C1 /* NSDateCompare.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDateCompare.swift; sourceTree = "<group>"; }; A1EB059F1D95696C008659C1 /* MessageBodyTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageBodyTableViewCell.swift; sourceTree = "<group>"; }; A1EB05A31D956E32008659C1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; - A1F1D7E31E83E93D0009CBDF /* SwitchCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SwitchCell.xib; sourceTree = "<group>"; }; A1F2A5681E85586300320275 /* Providers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Providers.swift; sourceTree = "<group>"; }; A1F992301DA7D22D0073BF1B /* de */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = de; path = de.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; A1F992321DA7D2360073BF1B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; @@ -600,9 +594,6 @@ isa = PBXGroup; children = ( A1F2A5681E85586300320275 /* Providers.swift */, - A18C76861E81861C00B21414 /* OnboardingViewController.swift */, - A17A06E81E8190C300C8AEF6 /* OnboardingViewCells.swift */, - A1F1D7E31E83E93D0009CBDF /* SwitchCell.xib */, A1083A531E8BFEA6003666B7 /* Onboarding.swift */, ); name = onboarding; @@ -806,7 +797,6 @@ buildActionMask = 2147483647; files = ( A1F992391DA7DD2E0073BF1B /* InboxTableViewCell.xib in Resources */, - A1F1D7E41E83E93D0009CBDF /* SwitchCell.xib in Resources */, A1EB058A1D956890008659C1 /* ContactCell.xib in Resources */, 4761420A1E082F9C00FD5E4F /* Settings.bundle in Resources */, A19C12471DE602FF007F72E7 /* jabo.asc in Resources */, @@ -1071,7 +1061,6 @@ 472F398E1E251B8D009260FB /* MailAddress.swift in Sources */, A135CF101DD4BDD1007E3C29 /* PGPOnePassSignaturePacket.m in Sources */, F12060821DA552FC00F6EF37 /* MailHandlerDelegator.swift in Sources */, - A17A06E91E8190C300C8AEF6 /* OnboardingViewCells.swift in Sources */, F1984D741E1E92B300804E1E /* LabelStyleKit.swift in Sources */, A15B7BE81E2934CB0024E499 /* EncryptionType.swift in Sources */, A1EB05861D956872008659C1 /* FrequentCell.swift in Sources */, @@ -1083,7 +1072,6 @@ 472F397E1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift in Sources */, A135CF1B1DD4BDD1007E3C29 /* PGPSecretSubKeyPacket.m in Sources */, A172F90D1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift in Sources */, - A18C76871E81861C00B21414 /* OnboardingViewController.swift in Sources */, A135CF071DD4BDD1007E3C29 /* PGPCompressedPacket.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/enzevalos_iphone/AppDelegate.swift b/enzevalos_iphone/AppDelegate.swift index 01cccb4eb147485171c5a67ce397b88967ee677b..180883537b2b6c83e8c1ab74acdff4a335e43e7d 100644 --- a/enzevalos_iphone/AppDelegate.swift +++ b/enzevalos_iphone/AppDelegate.swift @@ -22,7 +22,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. //UINavigationBar.appearance().backgroundColor = UIColor.blueColor() - ThemeManager.currentTheme() if (!UserDefaults.standard.bool(forKey: "launchedBefore")) { self.window = UIWindow(frame: UIScreen.main.bounds) diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index a37e58d7b0c08b44924d9555af3724c8fcbdff89..e0cc4c63f97664bbd38e254ad2a67fcfee1b8201 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -438,24 +438,6 @@ </objects> <point key="canvasLocation" x="-31.199999999999999" y="-949.47526236881572"/> </scene> - <!--Init View Controller--> - <scene sceneID="Mrv-VC-JsN"> - <objects> - <viewController id="bpj-aZ-wCZ" customClass="InitViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> - <layoutGuides> - <viewControllerLayoutGuide type="top" id="PLX-Da-XGG"/> - <viewControllerLayoutGuide type="bottom" id="HGD-sZ-too"/> - </layoutGuides> - <view key="view" contentMode="scaleToFill" id="top-pS-mh8"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - </view> - </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="RRR-L4-jfz" userLabel="First Responder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="834" y="-948"/> - </scene> <!--Inbox--> <scene sceneID="ue1-yd-fJq"> <objects> @@ -970,88 +952,7 @@ <size key="footerReferenceSize" width="0.0" height="0.0"/> <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> </collectionViewFlowLayout> - <cells> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="K2l-pc-7Ct"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="26x-eU-QWB"> - <rect key="frame" x="90" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="UiH-nA-0gD"> - <rect key="frame" x="180" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="tje-kJ-Wrn"> - <rect key="frame" x="270" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="s98-Hj-jpN"> - <rect key="frame" x="360" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="5oM-zr-fKL"> - <rect key="frame" x="450" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="dZt-Ck-FRF"> - <rect key="frame" x="540" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="4JR-3M-ptB"> - <rect key="frame" x="630" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="GPW-Nd-0KD"> - <rect key="frame" x="720" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="qgx-L7-bRo"> - <rect key="frame" x="810" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - </cells> + <cells/> <connections> <outletCollection property="gestureRecognizers" destination="b27-VB-voz" appends="YES" id="XZE-Dy-asu"/> <outletCollection property="gestureRecognizers" destination="Dyz-bi-xHw" appends="YES" id="LL1-Iz-H3Q"/> @@ -1089,88 +990,7 @@ <size key="footerReferenceSize" width="0.0" height="0.0"/> <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> </collectionViewFlowLayout> - <cells> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="5m2-6Y-9NT"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="DBp-X0-Ixz"> - <rect key="frame" x="90" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="F0w-yL-FnJ"> - <rect key="frame" x="180" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="BbP-GQ-7LM"> - <rect key="frame" x="270" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="z2O-ho-YAB"> - <rect key="frame" x="360" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Fdk-rc-v08"> - <rect key="frame" x="450" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="K3g-dl-n9K"> - <rect key="frame" x="540" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="GST-wo-9BA"> - <rect key="frame" x="630" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="s4l-JR-nx4"> - <rect key="frame" x="720" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="mU7-wR-fF4"> - <rect key="frame" x="810" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - </cells> + <cells/> <connections> <outletCollection property="gestureRecognizers" destination="7ir-1V-kSk" appends="YES" id="l5Z-Xj-HlA"/> </connections> @@ -1317,7 +1137,7 @@ </connections> </barButtonItem> <button key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iUk-lk-1LN"> - <rect key="frame" x="142" y="-6" width="90" height="56"/> + <rect key="frame" x="143" y="-6" width="90" height="56"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/> <connections> <action selector="iconButtonPressed:" destination="4Ey-v4-VeB" eventType="touchUpInside" id="Opj-Y1-Vtg"/> diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift index 73c643f18debf76c0e8f7af804d88f7bfd6a3099..7469fde1a7ee7de814fc933e7468a9297b85023c 100644 --- a/enzevalos_iphone/DataHandler.swift +++ b/enzevalos_iphone/DataHandler.swift @@ -345,7 +345,7 @@ class DataHandler { // -------- End handle to, cc, from addresses -------- - func createMail(_ uid: UInt64, sender: MCOAddress, receivers: [MCOAddress], cc: [MCOAddress], time: Date, received: Bool, subject: String, body: String, flags: MCOMessageFlag, record: KeyRecord?, autocrypt: AutocryptContact?) -> Mail { + func createMail(_ uid: UInt64, sender: MCOAddress, receivers: [MCOAddress], cc: [MCOAddress], time: Date, received: Bool, subject: String, body: String, flags: MCOMessageFlag, record: KeyRecord?, autocrypt: AutocryptContact?) /*-> Mail*/ { let finding = findNum("Mail", type: "uid", search: uid) let mail: Mail @@ -374,7 +374,7 @@ class DataHandler { mail.decryptIfPossible() } else { - return finding![0] as! Mail + return //finding![0] as! Mail } save() @@ -392,7 +392,7 @@ class DataHandler { } - return mail + //return mail } private func readMails() -> [Mail] { diff --git a/enzevalos_iphone/Encryption.swift b/enzevalos_iphone/Encryption.swift index 024869b2566b715235558a242deaacaa9ac30619..be88b2933e0dfba21f54ecf34b64d9d904ec5785 100644 --- a/enzevalos_iphone/Encryption.swift +++ b/enzevalos_iphone/Encryption.swift @@ -71,12 +71,12 @@ public protocol Encryption { func signAndEncrypt(_ text: String, keyIDs: [String]) -> Data? func signAndEncrypt(_ text: String, mailaddresses: [String]) -> Data? - func addKey(_ keyData: Data, forMailAddresses: [String]?) -> String? + @discardableResult func addKey(_ keyData: Data, forMailAddresses: [String]?) -> String? - func addKey(_ keyData: Data, forMailAddresses: [String]?, discoveryMailUID: UInt64?) -> String? + @discardableResult func addKey(_ keyData: Data, forMailAddresses: [String]?, discoveryMailUID: UInt64?) -> String? //key is connected to the senders address, if discoveryMail is set - func addKey(_ keyData: Data, discoveryMail: Mail?) -> String? + @discardableResult func addKey(_ keyData: Data, discoveryMail: Mail?) -> String? //will be maybe deleted... because keyWrapper will be added when constructed //func addKey(key: KeyWrapper, forMailAddress: [String]?, callBack: ((success: Bool) -> Void)?) diff --git a/enzevalos_iphone/EncryptionHandler.swift b/enzevalos_iphone/EncryptionHandler.swift index 07c6aa4f8a4a8a223b0e4bf165931f57627fc486..4b8f77c04231d2d0346eda2e13f84ca575323ae6 100644 --- a/enzevalos_iphone/EncryptionHandler.swift +++ b/enzevalos_iphone/EncryptionHandler.swift @@ -11,6 +11,13 @@ import Foundation public protocol EncryptionHandler { //var keychain + //----- static stuff ----- + // static func getEncryption(_ encryptionType: EncryptionType) -> Encryption? + // static func hasKey(_ enzContact: EnzevalosContact) -> Bool + // static func hasKey(_ mailAddress: String) -> Bool + // static func getEncryptionTypeForMail(_ mail: Mail) -> EncryptionType + // static func sortMailaddressesByEncryption(_ mailaddresses: [String]) -> [EncryptionType: [String]] + // static func sortMailaddressesByEncryptionMCOAddress(_ mailaddresses: [String]) -> [EncryptionType: [MCOAddress]] //handle entrys in keychain for different Encryptions diff --git a/enzevalos_iphone/IconsStyleKit.swift b/enzevalos_iphone/IconsStyleKit.swift index b250367f4eb43ca9da234baa35f8bcca0d02afcf..7b23385ee12945541e56c210be845e6c858964ff 100644 --- a/enzevalos_iphone/IconsStyleKit.swift +++ b/enzevalos_iphone/IconsStyleKit.swift @@ -539,7 +539,7 @@ open class IconsStyleKit : NSObject { set { Cache.letterTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetter) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetter) } } } @@ -549,7 +549,7 @@ open class IconsStyleKit : NSObject { set { Cache.letterCorruptedTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterCorrupted) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterCorrupted) } } } @@ -559,7 +559,7 @@ open class IconsStyleKit : NSObject { set { Cache.postcardTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfPostcard) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfPostcard) } } } @@ -569,7 +569,7 @@ open class IconsStyleKit : NSObject { set { Cache.letterOpenTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterOpen) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterOpen) } } } diff --git a/enzevalos_iphone/InitViewController.swift b/enzevalos_iphone/InitViewController.swift index a1221afef3695a617109cbf1f7a918550f356e26..5cf67b181f6be69d0e5592f9d83f9f2297ab2b6e 100644 --- a/enzevalos_iphone/InitViewController.swift +++ b/enzevalos_iphone/InitViewController.swift @@ -20,7 +20,7 @@ class InitViewController : UIViewController { let manager = MCOMailProvidersManager.shared()!//.init() //sharedManager() print(manager) let path = Bundle.main.path(forResource: "providers", ofType: "json") - print(path) + print(path ?? "nil") manager.registerProviders(withFilename: path) print(manager.provider(forEmail: "alice2005@web.de") == nil) print(manager.provider(forEmail: "alice2005@aol.com") == nil) //x @@ -37,7 +37,7 @@ class InitViewController : UIViewController { print(manager.provider(forMX: "web.de").imapServices()) print(manager.provider(forMX: "web.de").smtpServices()) - var nService : MCONetService = (manager.provider(forMX: "web.de").smtpServices() as! [MCONetService])[0] + let nService : MCONetService = (manager.provider(forMX: "web.de").smtpServices() as! [MCONetService])[0] print(nService.info()) } diff --git a/enzevalos_iphone/LogHandler.swift b/enzevalos_iphone/LogHandler.swift index b6f5c720573fd5a8cb0186a82c3ef2c7b103e7e5..c890590a649dbcae1c3fd4703c3768ab6572b006 100644 --- a/enzevalos_iphone/LogHandler.swift +++ b/enzevalos_iphone/LogHandler.swift @@ -73,7 +73,7 @@ class LogHandler { print() print("--------------------LOG OUTPUT--------------------") print("LoggingSession ",session) - print(defaults.object(forKey: String(session)+"-date")) + print(defaults.object(forKey: String(session)+"-date") as Any) print() for i in 0 ..< defaults.integer(forKey: String(session)+"-index")+1{ if let entry = defaults.object(forKey: String(session)+"-"+String(i)) { diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift index b3d33264c224ca9864f070893eb906d7af15f713..e9523be641085b3f841fda709d03dd140ed5c16c 100644 --- a/enzevalos_iphone/MailHandler.swift +++ b/enzevalos_iphone/MailHandler.swift @@ -412,7 +412,7 @@ func parseMail(_ error: Error?, parser: MCOMessageParser?, message: MCOIMAPMessa enc?.addKey(pgpKey, forMailAddresses: [(header?.from.mailbox)!]) } catch { - print("Could not conntect key! \(autocrypt?.toString())") + print("Could not conntect key! \(autocrypt?.toString() ?? "empty autocrypt")") } } diff --git a/enzevalos_iphone/OnboardingViewCells.swift b/enzevalos_iphone/OnboardingViewCells.swift deleted file mode 100644 index 6d38ce4a9d1598631ab4c2aa3db3c34ac28c48ee..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/OnboardingViewCells.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// OnboardingViewCells.swift -// enzevalos_iphone -// -// Created by jakobsbode on 21.03.17. -// Copyright © 2017 fu-berlin. All rights reserved. -// - -import UIKit - -open class SwitchCell : UITableViewCell { - @IBOutlet weak var label: UILabel! - @IBOutlet weak var switcher: UISwitch! -} - -class InputCell : UITableViewCell { - @IBOutlet weak var label: UILabel! - @IBOutlet weak var textfield: UITextField! -} diff --git a/enzevalos_iphone/OnboardingViewController.swift b/enzevalos_iphone/OnboardingViewController.swift deleted file mode 100644 index 52d8024eab76547124ec6a383c1ba6f41a4398a0..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/OnboardingViewController.swift +++ /dev/null @@ -1,286 +0,0 @@ -// -// OnboardingViewController.swift -// enzevalos_iphone -// -// Created by jakobsbode on 21.03.17. -// Copyright © 2017 fu-berlin. All rights reserved. -// - -import Foundation -import UIKit - -class OnboardingViewController : UIViewController { - - var pKey = true - var jKey = true - var aKey = true - var q1Key = true - - var smtpCheckDone = false - var imapCheckDone = false - - var smtpCheck = false - var imapCheck = false - - var mailaddress : UITextField? = nil - var password : UITextField? = nil - - @IBOutlet var tableView: UITableView! - override func viewDidLoad() { - super.viewDidLoad() - self.tableView.dataSource = self - self.tableView.delegate = self - EnzevalosEncryptionHandler.getEncryption(.PGP)?.printAllKeyIDs() - } - - @IBAction func privateKey(_ sender: AnyObject, forEvent event: UIEvent) { - pKey = !pKey - } - @IBAction func jakobKey(_ sender: AnyObject, forEvent event: UIEvent) { - jKey = !jKey - } - @IBAction func aliceKey(_ sender: AnyObject, forEvent event: UIEvent) { - aKey = !aKey - } - @IBAction func quizer1Key(_ sender: AnyObject, forEvent event: UIEvent) { - q1Key = !q1Key - } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?){ - if segue.identifier == "onboarding" { - var mAddr = "" - var mPw = "" - if let addr = mailaddress?.text, addr != "" { - //if addr.componentsSeparatedByString("@")[1] != "web.de" { - // naechste view - //} - /*let guessedUserName = addr.componentsSeparatedByString("@")[0] - UserManager.storeUserValue(addr, attribute: Attribute.UserAddr)//Attribute.attributeValues[Attribute.UserAddr] = addr - UserManager.storeUserValue(guessedUserName, attribute: Attribute.UserName)*/ - mAddr = addr - } - if let pw = password?.text, pw != "" { - //UserManager.storeUserValue(pw, attribute: Attribute.UserPW)//Attribute.attributeValues[Attribute.UserPW] = pw - mPw = pw - } - self.setGuessValues(mAddr, pw: mPw) - for encType in iterateEnum(EncryptionType) { - let encryption = EnzevalosEncryptionHandler.getEncryption(encType) - if let enc = encryption { - enc.removeAllKeys() - } - } - EnzevalosEncryptionHandler.getEncryption(.PGP)?.printAllKeyIDs() - if pKey { - //--------------------------------------- - //Import private Key BEGIN - - var path = Bundle.main.path(forResource: "alice2005-private", ofType: "gpg") //<---- Schlüsseldatei - if mAddr.contains("@") && mAddr.components(separatedBy: "@")[1] == Provider.ENZEVALOS.rawValue { - path = Bundle.main.path(forResource: "quizer1-private", ofType: "asc") - } - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: []) - } - catch _ {} - - //Import private key END - //--------------------------------------- - } - if jKey { - //--------------------------------------- - //Import public Key BEGIN - - let path = Bundle.main.path(forResource: "JakobBode", ofType: "asc") //<---- Schlüsseldatei - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["jakob.bode@fu-berlin.de"]) //<---- Emailadresse - } - catch _ {} - - //Import public key END - //--------------------------------------- - } - if aKey { - //--------------------------------------- - //Import public Key BEGIN - - let path = Bundle.main.path(forResource: "alice2005-public", ofType: "gpg") //<---- Schlüsseldatei - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["alice2005@web.de"]) //<---- Emailadresse - } - catch _ {} - - //Import public key END - //--------------------------------------- - } - if q1Key { - //--------------------------------------- - //Import public Key BEGIN - - let path = Bundle.main.path(forResource: "quizer1-public", ofType: "asc") //<---- Schlüsseldatei - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["quizer1@enzevalos.de"]) //<---- Emailadresse - } - catch _ {} - - //Import public key END - //--------------------------------------- - } - UserDefaults.standard.set(true, forKey: "launchedBefore") - } - } - - func iterateEnum<T: Hashable>(_: T.Type) -> AnyIterator<T> { - var i = 0 - return AnyIterator { - let next = withUnsafePointer(to: &i) { UnsafeRawPointer($0).load(as: T.self) } - i += 1 - return next.hashValue == i-1 ? next : nil - } - } - - func setGuessValues(_ mailAddress: String, pw: String) { - if mailAddress != "" { - let guessedUserName = mailAddress.components(separatedBy: "@")[0] - let provider = mailAddress.components(separatedBy: "@")[1] - UserManager.storeUserValue(mailAddress as AnyObject?, attribute: Attribute.userAddr)//Attribute.attributeValues[Attribute.UserAddr] = addr - UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.userName) - if provider == Provider.FU.rawValue { - Providers.setValues(Provider.FU) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.accountname) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.userName) - } - if provider == Provider.ZEDAT.rawValue { - Providers.setValues(Provider.ZEDAT) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.accountname) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.userName) - } - if provider == Provider.ENZEVALOS.rawValue { - Providers.setValues(Provider.ENZEVALOS) - UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.accountname) - UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.userName) - } - } - if pw != "" { - UserManager.storeUserValue(pw as AnyObject?, attribute: Attribute.userPW) - } - smtpCheckDone = false - imapCheckDone = false - /*AppDelegate.getAppDelegate().mailHandler.checkSMTP(SMTPCompletion) - AppDelegate.getAppDelegate().mailHandler.checkIMAP(IMAPCompletion) - while (!imapCheckDone || !smtpCheckDone) { - - }*/ - print("checks ", imapCheck, smtpCheck) - } - - private func SMTPCompletion(_ error: NSError?) { - if error == nil { - smtpCheck = true - } - smtpCheckDone = true - } - - private func IMAPCompletion(_ error: NSError?) { - if error == nil { - imapCheck = true - } - imapCheckDone = true - } - -} - -extension OnboardingViewController : UITableViewDelegate { - -} - -extension OnboardingViewController : UITableViewDataSource { - - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if section == 0 { - return 2 - } - if section == 1 { - return 4 - } - return 0 - } - - func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - if section == 0 { - return "Credentials" - } - return "Keys" - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - if indexPath.section == 0 { - if indexPath.row == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "InputCell") as! InputCell - cell.label.text = "Mailaddress" - cell.textfield.placeholder = "address" - cell.textfield.keyboardType = UIKeyboardType.emailAddress - cell.textfield.autocorrectionType = UITextAutocorrectionType.no - self.mailaddress = cell.textfield - return cell - } - if indexPath.row == 1 { - let cell = tableView.dequeueReusableCell(withIdentifier: "InputCell") as! InputCell - cell.label.text = "Password" - cell.textfield.placeholder = "password" - cell.textfield.isSecureTextEntry = true - self.password = cell.textfield - return cell - - } - } - if indexPath.section == 1 { - if indexPath.row == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import private key" - cell.switcher.addTarget(self, action: #selector(privateKey), for: .valueChanged) - return cell - } - if indexPath.row == 1 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import jakob's pub-key" - cell.switcher.addTarget(self, action: #selector(jakobKey), for: .valueChanged) - return cell - } - if indexPath.row == 2 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import alice's pub-key" - cell.switcher.addTarget(self, action: #selector(aliceKey), for: .valueChanged) - return cell - } - if indexPath.row == 3 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import quizer1's pub-key" - cell.switcher.addTarget(self, action: #selector(quizer1Key), for: .valueChanged) - return cell - } - } - let cell = tableView.dequeueReusableCell(withIdentifier: "AliceKeyCell")! - return cell - } - - func numberOfSections(in tableView: UITableView) -> Int { - return 2 - } -} diff --git a/enzevalos_iphone/PGPEncryption.swift b/enzevalos_iphone/PGPEncryption.swift index 212483b9bee61c226c3aeef7d87ef4f05c8ba76f..53d96bf212ff061662f0077c10865dd36c576cbc 100644 --- a/enzevalos_iphone/PGPEncryption.swift +++ b/enzevalos_iphone/PGPEncryption.swift @@ -126,14 +126,17 @@ class PGPEncryption : Encryption { if self.isUsed(mail) { let bodyData = mail.body!.data(using: String.Encoding.utf8)! var data: Data? + //has to be var because it is given as pointer to obj-c-code var error: NSErrorPointer = NSErrorPointer.none var temp = keyManager.pgp.decryptDataFirstPart(bodyData, passphrase: nil, integrityProtected: nil, error: error) var maybeUsedKeys: [String] = [] + //has to be var because it is given as pointer to obj-c-code var signed = UnsafeMutablePointer<ObjCBool>.allocate(capacity: 1) signed[0] = false + //has to be var because it is given as pointer to obj-c-code var valid = UnsafeMutablePointer<ObjCBool>.allocate(capacity: 1) valid[0] = false - print(temp.incompleteKeyID," ",temp.onePassSignaturePacket) + //print(temp.incompleteKeyID," ",temp.onePassSignaturePacket) data = temp.plaintextData if data == nil { self.keyManager.useAllPrivateKeys() @@ -156,9 +159,8 @@ class PGPEncryption : Encryption { if let key = self.keyManager.getKey(maybeUsedKey) { //FIXME let done : ObjCBool - do { - try done = (self.keyManager.pgp.decryptDataSecondPart(temp, verifyWithPublicKey: key.key, signed: signed, valid: valid)[0]) - }catch { + done = (self.keyManager.pgp.decryptDataSecondPart(temp, verifyWithPublicKey: key.key, signed: signed, valid: valid, error: error)[0]) + if let errorHappening = (error?.debugDescription.contains("Missing")), errorHappening { mail.trouble = true mail.isCorrectlySigned = false break diff --git a/enzevalos_iphone/PGPKeyManagement.swift b/enzevalos_iphone/PGPKeyManagement.swift index 56481828cbba8b3799205a87cc60d3c4c9aaefe9..59fa006d04ac5ccd00ea70c4dc3e30b2e670eb98 100644 --- a/enzevalos_iphone/PGPKeyManagement.swift +++ b/enzevalos_iphone/PGPKeyManagement.swift @@ -64,7 +64,7 @@ class PGPKeyManagement { return index } - func addKey(_ key: PGPKeyWrapper, forMailAddresses: [String]) -> String{ + @discardableResult func addKey(_ key: PGPKeyWrapper, forMailAddresses: [String]) -> String{ var index : Int64 = 0 let searchKey = key.key.keyID.longKeyString+"-index" var existent = false diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift index 72ba82aa3f32272a30e1decd04d7302d7bf05d02..bc0c77a034511cd845273c1754e4175e54c7deac 100644 --- a/enzevalos_iphone/SendViewController.swift +++ b/enzevalos_iphone/SendViewController.swift @@ -344,7 +344,7 @@ class SendViewController: UIViewController { func mailSend(_ error: Error?) { if (error != nil) { - NSLog("Error sending email: \(error)") + NSLog("Error sending email: \(String(describing: error))") AppDelegate.getAppDelegate().showMessage("An error occured", completion: nil) } else { NSLog("Send successful!") diff --git a/enzevalos_iphone/SwitchCell.xib b/enzevalos_iphone/SwitchCell.xib deleted file mode 100644 index d6995916c5c8a1301cd1132ed7ac3fd2a65e0e16..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/SwitchCell.xib +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> - <device id="retina4_7" orientation="portrait"> - <adaptation id="fullscreen"/> - </device> - <dependencies> - <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> - <capability name="Constraints to layout margins" minToolsVersion="6.0"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SwitchCell" id="Gm7-G9-1ZQ" customClass="SwitchCell" customModule="enzevalos_iphone" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Gm7-G9-1ZQ" id="t2J-0m-8Qs"> - <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7wk-9h-yLU"> - <rect key="frame" x="312" y="6" width="51" height="31"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - </switch> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fqM-ef-jLI"> - <rect key="frame" x="16" y="11" width="288" height="21"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - </subviews> - </tableViewCellContentView> - <connections> - <outlet property="label" destination="fqM-ef-jLI" id="t5e-16-gWe"/> - <outlet property="switcher" destination="7wk-9h-yLU" id="1zw-0J-QIX"/> - </connections> - <point key="canvasLocation" x="-899" y="-537"/> - </tableViewCell> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="InputCell" id="WPX-Cb-BHm" customClass="InputCell" customModule="enzevalos_iphone" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WPX-Cb-BHm" id="ow3-rZ-z80"> - <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GNY-Wr-Z6n"> - <rect key="frame" x="14" y="11" width="103" height="21"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Input" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="GGS-za-Wwh"> - <rect key="frame" x="118" y="10.5" width="249" height="21"/> - <nil key="textColor"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <textInputTraits key="textInputTraits"/> - </textField> - </subviews> - <constraints> - <constraint firstItem="GNY-Wr-Z6n" firstAttribute="top" secondItem="ow3-rZ-z80" secondAttribute="topMargin" constant="3" id="G0d-lN-C8N"/> - <constraint firstItem="GGS-za-Wwh" firstAttribute="leading" secondItem="GNY-Wr-Z6n" secondAttribute="trailing" constant="1" id="Q2Z-qO-z6B"/> - <constraint firstItem="GGS-za-Wwh" firstAttribute="leading" secondItem="ow3-rZ-z80" secondAttribute="leadingMargin" constant="110" id="SzI-89-I9C"/> - <constraint firstItem="GGS-za-Wwh" firstAttribute="centerY" secondItem="GNY-Wr-Z6n" secondAttribute="centerY" id="a96-Fl-lM0"/> - <constraint firstAttribute="trailingMargin" secondItem="GGS-za-Wwh" secondAttribute="trailing" id="c3e-4H-e3r"/> - <constraint firstItem="GNY-Wr-Z6n" firstAttribute="leading" secondItem="ow3-rZ-z80" secondAttribute="leadingMargin" constant="6" id="dUr-77-AnE"/> - </constraints> - </tableViewCellContentView> - <connections> - <outlet property="label" destination="GNY-Wr-Z6n" id="1kE-w9-S1a"/> - <outlet property="textfield" destination="GGS-za-Wwh" id="MCG-JF-cNI"/> - </connections> - <point key="canvasLocation" x="-899.5" y="-424"/> - </tableViewCell> - </objects> -</document> diff --git a/enzevalos_iphone/UserData.swift b/enzevalos_iphone/UserData.swift index aa99d3656c1457ac5664e002b5bf625549f1782c..be89c5595e7849b1150d36255c78784fc7d8a1ce 100644 --- a/enzevalos_iphone/UserData.swift +++ b/enzevalos_iphone/UserData.swift @@ -55,10 +55,9 @@ enum Attribute: Int{ struct UserManager{ - static func storeUserValue(_ value: AnyObject?, attribute: Attribute) -> Bool{ + static func storeUserValue(_ value: AnyObject?, attribute: Attribute) { UserDefaults.standard.setValue(value, forKey: "\(attribute.hashValue)") UserDefaults.standard.synchronize() - return true } static func loadUserValue(_ attribute: Attribute) -> AnyObject?{