|
@@ -1274,6 +1274,7 @@
|
|
|
[app messageNotification:@"E2E public key" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
|
|
|
break;
|
|
|
case 404:
|
|
|
+ [self signEndToEndPublicKey];
|
|
|
message = @"one or more public keys couldn't be found";
|
|
|
break;
|
|
|
case 409:
|
|
@@ -1289,6 +1290,31 @@
|
|
|
[[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionEndToEndEncryption selector:metadataNet.selector note:message type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:app.activeUrl];
|
|
|
}
|
|
|
|
|
|
+- (void)signEndToEndPublicKey
|
|
|
+{
|
|
|
+ [[NCEndToEndEncryption sharedManager] generateCertificateX509WithDirectoryUser:app.directoryUser userID:app.activeUserID finished:^(NSError *error) {
|
|
|
+
|
|
|
+ CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
|
|
|
+
|
|
|
+ if (!error) {
|
|
|
+
|
|
|
+ NSError *error;
|
|
|
+
|
|
|
+ NSString *fileNamePath = [NSString stringWithFormat:@"%@/e2e_certificate.pem", app.directoryUser];
|
|
|
+ NSString *certificate = [NSString stringWithContentsOfFile:fileNamePath encoding:NSUTF8StringEncoding error:&error];
|
|
|
+ NSString *certificateEncoded = [certificate stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+
|
|
|
+ metadataNet.action = actionSignEndToEndPublicKey;
|
|
|
+ metadataNet.options = certificateEncoded;
|
|
|
+
|
|
|
+ [app addNetworkingOperationQueue:app.netQueue delegate:self metadataNet:metadataNet];
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark -
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
#pragma mark ==== Download Thumbnail Delegate ====
|