Quellcode durchsuchen

Improvements E2EE

marinofaggiana vor 4 Jahren
Ursprung
Commit
142ef5383c

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2888,8 +2888,8 @@
 			isa = XCRemoteSwiftPackageReference;
 			repositoryURL = "https://github.com/nextcloud/ios-communication-library/";
 			requirement = {
-				kind = exactVersion;
-				version = 0.97.0;
+				kind = revision;
+				revision = 27566a376916cb75b93d48b35cca0462d190555a;
 			};
 		};
 		F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {

+ 2 - 2
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -105,8 +105,8 @@
         "repositoryURL": "https://github.com/nextcloud/ios-communication-library/",
         "state": {
           "branch": null,
-          "revision": "e26939278c34dbe66a5a25963906651570b51fbe",
-          "version": "0.97.0"
+          "revision": "27566a376916cb75b93d48b35cca0462d190555a",
+          "version": null
         }
       },
       {

+ 9 - 9
iOSClient/Settings/NCEndToEndInitialize.swift

@@ -53,13 +53,13 @@ class NCEndToEndInitialize : NSObject  {
     
     func getPublicKey() {
     
-        NCCommunication.shared.getE2EEPublicKey { (account, publicKey, errorCode, errorDescription) in
+        NCCommunication.shared.getE2EECertificate { (account, certificate, errorCode, errorDescription) in
             
             if (errorCode == 0 && account == self.appDelegate.account) {
                 
-                CCUtility.setEndToEndPublicKey(account, publicKey: publicKey)
+                CCUtility.setEndToEndCertificate(account, certificate: certificate)
                 
-                self.extractedPublicKey = NCEndToEndEncryption.sharedManager().extractPublicKey(fromCertificate: publicKey)
+                self.extractedPublicKey = NCEndToEndEncryption.sharedManager().extractPublicKey(fromCertificate: certificate)
                 
                 // Request PrivateKey chiper to Server
                 self.getPrivateKeyCipher()
@@ -79,19 +79,19 @@ class NCEndToEndInitialize : NSObject  {
                         return
                     }
                     
-                    NCCommunication.shared.signE2EEPublicKey(publicKey: csr) { (account, publicKey, errorCode, errorDescription) in
+                    NCCommunication.shared.signE2EECertificate(certificate: csr) { (account, certificate, errorCode, errorDescription) in
                         
                         if (errorCode == 0 && account == self.appDelegate.account) {
                             
                             // TEST publicKey
-                            let extractedPublicKey = NCEndToEndEncryption.sharedManager().extractPublicKey(fromCertificate: publicKey)
+                            let extractedPublicKey = NCEndToEndEncryption.sharedManager().extractPublicKey(fromCertificate: certificate)
                             if extractedPublicKey != NCEndToEndEncryption.sharedManager().generatedPublicKey {
                                 
                                 NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "error: the public key is incorrect", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, forced: true)
                                 
                             } else {
                             
-                                CCUtility.setEndToEndPublicKey(account, publicKey: publicKey)
+                                CCUtility.setEndToEndCertificate(account, certificate: certificate)
                             
                                 // Request PrivateKey chiper to Server
                                 self.getPrivateKeyCipher()
@@ -140,7 +140,7 @@ class NCEndToEndInitialize : NSObject  {
                     
                     let passphrase = passphraseTextField?.text
                     
-                    let publicKey = CCUtility.getEndToEndPublicKey(self.appDelegate.account)
+                    let publicKey = CCUtility.getEndToEndCertificate(self.appDelegate.account)
                     
                     guard let privateKey = (NCEndToEndEncryption.sharedManager().decryptPrivateKey(privateKeyChiper, passphrase: passphrase, publicKey: publicKey)) else {
                         
@@ -162,7 +162,7 @@ class NCEndToEndInitialize : NSObject  {
                         if (errorCode == 0 && account == self.appDelegate.account) {
                             
                             //TODO: verifi if publicKey == NCCommunication.shared.getE2EEPublicKey
-                            // + (NSString *)getEndToEndPublicKey:(NSString *)account;
+                            // + (NSString *)getEndToEndCertificate:(NSString *)account;
                             
                             CCUtility.setEndToEndPublicKeyServer(account, publicKey: publicKey)
                             
@@ -245,7 +245,7 @@ class NCEndToEndInitialize : NSObject  {
                                     if (errorCode == 0 && account == self.appDelegate.account) {
                                         
                                         //TODO: verifi if publicKey == NCCommunication.shared.getE2EEPublicKey
-                                        // + (NSString *)getEndToEndPublicKey:(NSString *)account;
+                                        // + (NSString *)getEndToEndCertificate:(NSString *)account;
                                         
                                         CCUtility.setEndToEndPublicKeyServer(account, publicKey: publicKey)
                                         

+ 2 - 2
iOSClient/Utility/CCUtility.h

@@ -94,8 +94,8 @@
 + (BOOL)getFormatCompatibility;
 + (void)setFormatCompatibility:(BOOL)set;
 
-+ (NSString *)getEndToEndPublicKey:(NSString *)account;
-+ (void)setEndToEndPublicKey:(NSString *)account publicKey:(NSString *)publicKey;
++ (NSString *)getEndToEndCertificate:(NSString *)account;
++ (void)setEndToEndCertificate:(NSString *)account certificate:(NSString *)certificate;
 
 + (NSString *)getEndToEndPrivateKey:(NSString *)account;
 + (void)setEndToEndPrivateKey:(NSString *)account privateKey:(NSString *)privateKey;

+ 5 - 5
iOSClient/Utility/CCUtility.m

@@ -296,16 +296,16 @@
     [UICKeyChainStore setString:sSet forKey:@"formatCompatibility" service:NCGlobal.shared.serviceShareKeyChain];
 }
 
-+ (NSString *)getEndToEndPublicKey:(NSString *)account
++ (NSString *)getEndToEndCertificate:(NSString *)account
 {
     NSString *key = [E2E_PublicKey stringByAppendingString:account];
     return [UICKeyChainStore stringForKey:key service:NCGlobal.shared.serviceShareKeyChain];
 }
 
-+ (void)setEndToEndPublicKey:(NSString *)account publicKey:(NSString *)publicKey
++ (void)setEndToEndCertificate:(NSString *)account certificate:(NSString *)certificate
 {
     NSString *key = [E2E_PublicKey stringByAppendingString:account];
-    [UICKeyChainStore setString:publicKey forKey:key service:NCGlobal.shared.serviceShareKeyChain];
+    [UICKeyChainStore setString:certificate forKey:key service:NCGlobal.shared.serviceShareKeyChain];
 }
 
 + (NSString *)getEndToEndPrivateKey:(NSString *)account
@@ -349,7 +349,7 @@
     BOOL isE2EEEnabled = [[NCManageDatabase shared] getCapabilitiesServerBoolWithAccount:account elements:NCElementsJSON.shared.capabilitiesE2EEEnabled exists:false];
     NSString* versionE2EE = [[NCManageDatabase shared] getCapabilitiesServerStringWithAccount:account elements:NCElementsJSON.shared.capabilitiesE2EEApiVersion];
     
-    NSString *publicKey = [self getEndToEndPublicKey:account];
+    NSString *publicKey = [self getEndToEndCertificate:account];
     NSString *privateKey = [self getEndToEndPrivateKey:account];
     NSString *passphrase = [self getEndToEndPassphrase:account];
     NSString *publicKeyServer = [self getEndToEndPublicKeyServer:account];    
@@ -366,7 +366,7 @@
 
 + (void)clearAllKeysEndToEnd:(NSString *)account
 {
-    [self setEndToEndPublicKey:account publicKey:nil];
+    [self setEndToEndCertificate:account certificate:nil];
     [self setEndToEndPrivateKey:account privateKey:nil];
     [self setEndToEndPassphrase:account passphrase:nil];
     [self setEndToEndPublicKeyServer:account publicKey:nil];