Browse Source

move URL Encode key to OCNetworking

Marino Faggiana 7 years ago
parent
commit
7626c1245e

+ 6 - 6
iOSClient/Main/CCMain.m

@@ -1242,7 +1242,7 @@
     [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionEndToEndEncryption selector:metadataNet.selector note:@"EndToEndPublicKey present on Server" type:k_activityTypeSuccess verbose:k_activityVerboseHigh activeUrl:app.activeUrl];
     
 #ifdef DEBUG
-    [app messageNotification:@"Get E2E PublicKey" description:@"Success" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:0];
+    [app messageNotification:@"Get E2E PublicKey" description:@"Success" visible:YES delay:1 type:TWMessageBarMessageTypeSuccess errorCode:0];
 #endif
 }
 
@@ -1298,7 +1298,7 @@
     [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionEndToEndEncryption selector:metadataNet.selector note:@"EndToEndPublicKey stored on Server and stored locally" type:k_activityTypeSuccess verbose:k_activityVerboseHigh activeUrl:app.activeUrl];
     
 #ifdef DEBUG
-    [app messageNotification:@"Store E2E PublicKey" description:@"Success" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:0];
+    [app messageNotification:@"Store E2E PublicKey" description:@"Success" visible:YES delay:1 type:TWMessageBarMessageTypeSuccess errorCode:0];
 #endif
 }
 
@@ -1328,7 +1328,7 @@
     [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionEndToEndEncryption selector:metadataNet.selector note:@"EndToEndPrivateKey present on Server" type:k_activityTypeSuccess verbose:k_activityVerboseHigh activeUrl:app.activeUrl];
     
 #ifdef DEBUG
-    [app messageNotification:@"Get E2E PrivateKey" description:@"Success" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:0];
+    [app messageNotification:@"Get E2E PrivateKey" description:@"Success" visible:YES delay:1 type:TWMessageBarMessageTypeSuccess errorCode:0];
 #endif
 }
 
@@ -1387,7 +1387,7 @@
     [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionEndToEndEncryption selector:metadataNet.selector note:@"EndToEndPrivateKey stored on Server and stored locally" type:k_activityTypeSuccess verbose:k_activityVerboseHigh activeUrl:app.activeUrl];
     
 #ifdef DEBUG
-    [app messageNotification:@"Store E2E PrivateKey" description:@"Success" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:0];
+    [app messageNotification:@"Store E2E PrivateKey" description:@"Success" visible:YES delay:1 type:TWMessageBarMessageTypeSuccess errorCode:0];
 #endif
 }
 
@@ -1401,12 +1401,12 @@
 
 - (void)deleteEndToEndPrivateKeySuccess:(CCMetadataNet *)metadataNet
 {
-    [app messageNotification:@"E2E delete private key" description:@"Private key was deleted" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:0];
+    [app messageNotification:@"E2E delete private key" description:@"Private key was deleted" visible:YES delay:1 type:TWMessageBarMessageTypeSuccess errorCode:0];
 }
 
 - (void)deleteEndToEndPrivateKeyFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
 {
-    [app messageNotification:@"E2E delete private key" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+    [app messageNotification:@"E2E delete private key" description:message visible:YES delay:1 type:TWMessageBarMessageTypeError errorCode:errorCode];
 }
 
 #pragma mark -

+ 4 - 2
iOSClient/Networking/OCNetworking.m

@@ -1744,7 +1744,8 @@
 {
     OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
     
-    NSString *publicKey = _metadataNet.options;
+    // URL Encode
+    NSString *publicKey = [CCUtility URLEncodeStringFromString:_metadataNet.options];
 
     [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];
@@ -1780,7 +1781,8 @@
 {
     OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
     
-    NSString *privateKey = _metadataNet.options;
+    // URL Encode
+    NSString *privateKey = [CCUtility URLEncodeStringFromString:_metadataNet.options];
     
     [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];

+ 2 - 4
iOSClient/Security/NCEndToEndEncryption.m

@@ -268,8 +268,7 @@ cleanup:
         return nil;
     }
     
-    // return URLEncode
-    return [CCUtility URLEncodeStringFromString:csr];
+    return csr;
 }
 
 - (NSString *)createEndToEndPrivateKey:(NSString *)directoryUser mnemonic:(NSString *)mnemonic
@@ -298,8 +297,7 @@ cleanup:
         return nil;
     }
     
-    // return URLEncode
-    return [CCUtility URLEncodeStringFromString:privateKeyCipher];
+    return privateKeyCipher;
 }
 
 #