Add object detection, tracking, mobile notifications, and search to any security camera.
decrypt
roryclear255cac0454f7
diff --git a/clearcam/PGP.m b/clearcam/PGP.mindex ff3cb39..a0b7602 100644--- a/clearcam/PGP.m+++ b/clearcam/PGP.m@@ -44,13 +44,15 @@NSString *base64Key = [keyData base64EncodedStringWithOptions:0];NSLog(@"Public Key (Base64): %@", base64Key);//-++ /*NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *documentsDirectory = [paths firstObject];NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:@"image.jpg"];NSString *encryptedImagePath = [documentsDirectory stringByAppendingPathComponent:@"image.pgp"];[self encryptImageWithPublicKey:imagePath];[self decryptImageWithPrivateKey:encryptedImagePath];+ *///[self deleteKeysFromKeychain];}return self;diff --git a/clearcam/SceneDelegate.m b/clearcam/SceneDelegate.mindex 30ca4c7..0840507 100644--- a/clearcam/SceneDelegate.m+++ b/clearcam/SceneDelegate.m@@ -1,11 +1,13 @@#import "SceneDelegate.h"#import "ViewController.h" // Import your main view controller+#import "PGP.h" // Import your PGP class#import <UIKit/UIKit.h>@interface SceneDelegate () <UIDocumentInteractionControllerDelegate>@property (strong, nonatomic) UIDocumentInteractionController *docController;@property (strong, nonatomic) NSURL *pendingURL; // Store the URL if the app is launched from scratch+@property (strong, nonatomic) PGP *pgp; // Instance of your PGP class@end@@ -21,6 +23,12 @@self.window.rootViewController = navigationController;[self.window makeKeyAndVisible];+ // Initialize the PGP instance+ self.pgp = [[PGP alloc] init];+ if (!self.pgp) {+ NSLog(@"Failed to initialize PGP.");+ }+// Check if the app was launched with a URL (e.g., opening a .pgp file)if (connectionOptions.URLContexts.count > 0) {NSURL *url = connectionOptions.URLContexts.anyObject.URL;@@ -46,16 +54,18 @@}- (void)handlePGPFileAtURL:(NSURL *)url {- // Get the path to the app's documents directory- NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask].firstObject;+ // Decrypt the .pgp file using the PGP class+ NSString *encryptedFilePath = url.path;+ [self.pgp decryptImageWithPrivateKey:encryptedFilePath];- // Create a URL for the "image.jpg" file in the documents directory- NSURL *imageURL = [documentsDirectoryURL URLByAppendingPathComponent:@"image.jpg"];+ // Get the path to the decrypted .jpg file+ NSString *decryptedFilePath = [[encryptedFilePath stringByDeletingPathExtension] stringByAppendingPathExtension:@"jpg"];+ NSURL *decryptedFileURL = [NSURL fileURLWithPath:decryptedFilePath];- // Check if the file exists at the path- if ([[NSFileManager defaultManager] fileExistsAtPath:imageURL.path]) {- // Create a UIDocumentInteractionController for the image file- self.docController = [UIDocumentInteractionController interactionControllerWithURL:imageURL];+ // Check if the decrypted file exists+ if ([[NSFileManager defaultManager] fileExistsAtPath:decryptedFilePath]) {+ // Create a UIDocumentInteractionController for the decrypted file+ self.docController = [UIDocumentInteractionController interactionControllerWithURL:decryptedFileURL];// Set the delegate to selfself.docController.delegate = self;@@ -64,7 +74,7 @@[self.docController presentPreviewAnimated:YES];} else {// If the file doesn't exist, log an error or show an alert- NSLog(@"File 'image.jpg' not found in documents folder.");+ NSLog(@"Decrypted file not found at %@", decryptedFilePath);}}diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 1617dde..5ae99da 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -5,7 +5,7 @@#import "FileServer.h"#import "SettingsManager.h"#import "SceneState.h"-#import "pgp.h"+//#import "pgp.h"@interface ViewController ()@@ -45,7 +45,7 @@ NSMutableDictionary *classColorMap;- (void)viewDidLoad {[super viewDidLoad];- PGP *pgp = [[PGP alloc] init];+ //PGP *pgp = [[PGP alloc] init];self.scene = [[SceneState alloc] init];self.segmentQueue = dispatch_queue_create("com.example.segmentQueue", DISPATCH_QUEUE_SERIAL);self.current_segment_squares = [[NSMutableArray alloc] init];