Skip to content

Commit

Permalink
Shader and Swift updates.
Browse files Browse the repository at this point in the history
- New shader build script.
- Swift platform macros.
  • Loading branch information
cjcaufield committed Mar 10, 2016
1 parent 1339c34 commit ede6bb1
Show file tree
Hide file tree
Showing 22 changed files with 1,087 additions and 132 deletions.
59 changes: 59 additions & 0 deletions EncryptFile/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// main.m
// EncryptFile
//
// Created by Colin Caufield on 2016-03-07.
// Copyright © 2016 Secret Geometry, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AQDataExtensions.h"

#define VALIDATE

int main(int argc, const char* argv[])
{
if (argc != 4)
{
NSLog(@"Usage: EncryptFile <input-file> <output-file> <password>.\n");
return 1;
}

NSString* inputFilename = [NSString stringWithUTF8String:argv[1]];
NSString* outputFilename = [NSString stringWithUTF8String:argv[2]];
NSString* password = [NSString stringWithUTF8String:argv[3]];

NSData* rawData = [NSData dataWithContentsOfFile:inputFilename];
if (rawData == nil || rawData.length == 0)
{
NSLog(@"Error reading from file %@.\n", inputFilename);
return 1;
}

NSData* encryptedData = [rawData dataEncryptedWithPassword:password];
if (encryptedData == nil || encryptedData.length == 0)
{
NSLog(@"Error encrypting with password %@.\n", password);
return 1;
}

BOOL writeOk = [encryptedData writeToFile:outputFilename atomically:NO];
if (writeOk == NO)
{
NSLog(@"Error writing to file %@.\n", outputFilename);
return 1;
}

#ifdef VALIDATE

NSData* unencryptedData = [encryptedData dataDecryptedWithPassword:password];
if (unencryptedData == nil || ![unencryptedData isEqualToData:rawData])
{
NSLog(@"Validation failed.\n");
return 1;
}

#endif

return 0;
}
5 changes: 5 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ target 'SGLKitTouch' do
platform :ios, '9.0'
pod 'OpenSSL', '~> 1.0'
end

target 'EncryptFile' do
platform :osx, '10.9'
pod 'OpenSSL', '~> 1.0'
end
296 changes: 221 additions & 75 deletions Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions Pods/Target Support Files/Pods-EncryptFile/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ede6bb1

Please sign in to comment.