Marino Faggiana 7 سال پیش
والد
کامیت
09262400c0
2فایلهای تغییر یافته به همراه15 افزوده شده و 3 حذف شده
  1. 11 0
      iOSClient/Main/CCMain.m
  2. 4 3
      iOSClient/Security/NCEndToEndEncryption.m

+ 11 - 0
iOSClient/Main/CCMain.m

@@ -4988,6 +4988,17 @@
         // se il file esiste andiamo direttamente al delegato altrimenti carichiamolo
         if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, _metadata.fileID]]) {
             
+#ifdef DEBUG
+            // TEST ENCRYPTED/DECRYPTED
+            if ([_metadata.fileName containsString:@"enc.dms"]) {
+                [[NCEndToEndEncryption sharedManager] decryptMetadata:_metadata activeUrl:app.directoryUser];
+            }
+            
+            if ([_metadata.fileName containsString:@"test_encry_marino.jpg"]) {
+                [[NCEndToEndEncryption sharedManager] encryptMetadata:_metadata activeUrl:app.directoryUser];
+            }
+#endif
+            
             [self downloadFileSuccess:_metadata.fileID serverUrl:serverUrl selector:selectorLoadFileView selectorPost:nil];
             
         } else {

+ 4 - 3
iOSClient/Security/NCEndToEndEncryption.m

@@ -595,9 +595,10 @@ cleanup:
     [initVectorData getBytes:cIv length:AES_IVEC_LENGTH];
     
     // set up tag
-    //unsigned char cTag[AES_GCM_TAG_LENGTH];
-    //bzero(cTag, AES_GCM_TAG_LENGTH);
-    //[tagData getBytes:cTag length:AES_GCM_TAG_LENGTH];
+    NSData *tagData = [[NSData alloc] initWithBase64EncodedString:tag options:0];
+    unsigned char cTag[AES_GCM_TAG_LENGTH];
+    bzero(cTag, AES_GCM_TAG_LENGTH);
+    [tagData getBytes:cTag length:AES_GCM_TAG_LENGTH];
     
     /* verify tag if exists*/
     if (tag) {