Permalink
Browse files

first version

  • Loading branch information...
lakesoft committed Jun 2, 2011
1 parent d489177 commit 412010a4c38b0a8fe0e6642b07149d48a72e0c95
@@ -22,6 +22,10 @@
4C1000CF139324DB00C9257E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C1000CD139324DB00C9257E /* InfoPlist.strings */; };
4C1000D2139324DB00C9257E /* FBEncryptTests.h in Resources */ = {isa = PBXBuildFile; fileRef = 4C1000D1139324DB00C9257E /* FBEncryptTests.h */; };
4C1000D4139324DB00C9257E /* FBEncryptTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1000D3139324DB00C9257E /* FBEncryptTests.m */; };
+ 4C1000E01393250900C9257E /* FBEncryptorAES.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1000DF1393250900C9257E /* FBEncryptorAES.m */; };
+ 4C1000E11393250900C9257E /* FBEncryptorAES.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1000DF1393250900C9257E /* FBEncryptorAES.m */; };
+ 4C10010E13932FC400C9257E /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10010C13932FC400C9257E /* NSData+Base64.m */; };
+ 4C10010F13932FC400C9257E /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10010C13932FC400C9257E /* NSData+Base64.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -39,22 +43,26 @@
4C1000A4139324DB00C9257E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
4C1000A6139324DB00C9257E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4C1000A8139324DB00C9257E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- 4C1000AC139324DB00C9257E /* FBEncrypt-Info.plist */ = {isa = PBXFileReference; path = "FBEncrypt-Info.plist"; sourceTree = "<group>"; };
+ 4C1000AC139324DB00C9257E /* FBEncrypt-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FBEncrypt-Info.plist"; sourceTree = "<group>"; };
4C1000AE139324DB00C9257E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- 4C1000B0139324DB00C9257E /* FBEncrypt-Prefix.pch */ = {isa = PBXFileReference; path = "FBEncrypt-Prefix.pch"; sourceTree = "<group>"; };
+ 4C1000B0139324DB00C9257E /* FBEncrypt-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBEncrypt-Prefix.pch"; sourceTree = "<group>"; };
4C1000B1139324DB00C9257E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 4C1000B3139324DB00C9257E /* FBEncryptAppDelegate.h */ = {isa = PBXFileReference; path = FBEncryptAppDelegate.h; sourceTree = "<group>"; };
+ 4C1000B3139324DB00C9257E /* FBEncryptAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBEncryptAppDelegate.h; sourceTree = "<group>"; };
4C1000B4139324DB00C9257E /* FBEncryptAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBEncryptAppDelegate.m; sourceTree = "<group>"; };
4C1000B7139324DB00C9257E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = "<group>"; };
- 4C1000B9139324DB00C9257E /* FBEncryptViewController.h */ = {isa = PBXFileReference; path = FBEncryptViewController.h; sourceTree = "<group>"; };
+ 4C1000B9139324DB00C9257E /* FBEncryptViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBEncryptViewController.h; sourceTree = "<group>"; };
4C1000BA139324DB00C9257E /* FBEncryptViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBEncryptViewController.m; sourceTree = "<group>"; };
4C1000BD139324DB00C9257E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/FBEncryptViewController.xib; sourceTree = "<group>"; };
4C1000C4139324DB00C9257E /* FBEncryptTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FBEncryptTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
- 4C1000CC139324DB00C9257E /* FBEncryptTests-Info.plist */ = {isa = PBXFileReference; path = "FBEncryptTests-Info.plist"; sourceTree = "<group>"; };
+ 4C1000CC139324DB00C9257E /* FBEncryptTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FBEncryptTests-Info.plist"; sourceTree = "<group>"; };
4C1000CE139324DB00C9257E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- 4C1000D0139324DB00C9257E /* FBEncryptTests-Prefix.pch */ = {isa = PBXFileReference; path = "FBEncryptTests-Prefix.pch"; sourceTree = "<group>"; };
+ 4C1000D0139324DB00C9257E /* FBEncryptTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBEncryptTests-Prefix.pch"; sourceTree = "<group>"; };
4C1000D1139324DB00C9257E /* FBEncryptTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBEncryptTests.h; sourceTree = "<group>"; };
4C1000D3139324DB00C9257E /* FBEncryptTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBEncryptTests.m; sourceTree = "<group>"; };
+ 4C1000DE1393250900C9257E /* FBEncryptorAES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBEncryptorAES.h; sourceTree = "<group>"; };
+ 4C1000DF1393250900C9257E /* FBEncryptorAES.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBEncryptorAES.m; sourceTree = "<group>"; };
+ 4C10010C13932FC400C9257E /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = "<group>"; };
+ 4C10010D13932FC400C9257E /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -84,7 +92,8 @@
4C100095139324DA00C9257E = {
isa = PBXGroup;
children = (
- 4C1000AA139324DB00C9257E /* FBEncrypt */,
+ 4C1000DD139324F300C9257E /* FBEncryptor */,
+ 4C1000AA139324DB00C9257E /* Test Application */,
4C1000CA139324DB00C9257E /* FBEncryptTests */,
4C1000A3139324DB00C9257E /* Frameworks */,
4C1000A1139324DB00C9257E /* Products */,
@@ -110,7 +119,7 @@
name = Frameworks;
sourceTree = "<group>";
};
- 4C1000AA139324DB00C9257E /* FBEncrypt */ = {
+ 4C1000AA139324DB00C9257E /* Test Application */ = {
isa = PBXGroup;
children = (
4C1000B3139324DB00C9257E /* FBEncryptAppDelegate.h */,
@@ -121,6 +130,7 @@
4C1000BC139324DB00C9257E /* FBEncryptViewController.xib */,
4C1000AB139324DB00C9257E /* Supporting Files */,
);
+ name = "Test Application";
path = FBEncrypt;
sourceTree = "<group>";
};
@@ -155,6 +165,17 @@
name = "Supporting Files";
sourceTree = "<group>";
};
+ 4C1000DD139324F300C9257E /* FBEncryptor */ = {
+ isa = PBXGroup;
+ children = (
+ 4C1000DE1393250900C9257E /* FBEncryptorAES.h */,
+ 4C1000DF1393250900C9257E /* FBEncryptorAES.m */,
+ 4C10010C13932FC400C9257E /* NSData+Base64.m */,
+ 4C10010D13932FC400C9257E /* NSData+Base64.h */,
+ );
+ name = FBEncryptor;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -263,6 +284,8 @@
4C1000B2139324DB00C9257E /* main.m in Sources */,
4C1000B5139324DB00C9257E /* FBEncryptAppDelegate.m in Sources */,
4C1000BB139324DB00C9257E /* FBEncryptViewController.m in Sources */,
+ 4C1000E01393250900C9257E /* FBEncryptorAES.m in Sources */,
+ 4C10010E13932FC400C9257E /* NSData+Base64.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -271,6 +294,8 @@
buildActionMask = 2147483647;
files = (
4C1000D4139324DB00C9257E /* FBEncryptTests.m in Sources */,
+ 4C1000E11393250900C9257E /* FBEncryptorAES.m in Sources */,
+ 4C10010F13932FC400C9257E /* NSData+Base64.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -443,6 +468,7 @@
4C1000D9139324DB00C9257E /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
4C1000DA139324DB00C9257E /* Build configuration list for PBXNativeTarget "FBEncryptTests" */ = {
isa = XCConfigurationList;
@@ -451,6 +477,7 @@
4C1000DC139324DB00C9257E /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
@@ -1,9 +1,23 @@
//
-// FBEncryptAppDelegate.h
-// FBEncrypt
+// Copyright (c) 2011 Five-technology Co.,Ltd.
//
-// Created by Hiroshi Hashiguchi on 11/05/30.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
//
#import <UIKit/UIKit.h>
@@ -1,20 +1,32 @@
//
-// FBEncryptAppDelegate.m
-// FBEncrypt
+// Copyright (c) 2011 Five-technology Co.,Ltd.
//
-// Created by Hiroshi Hashiguchi on 11/05/30.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
//
#import "FBEncryptAppDelegate.h"
-
#import "FBEncryptViewController.h"
@implementation FBEncryptAppDelegate
@synthesize window=_window;
-
@synthesize viewController=_viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -1,9 +1,23 @@
//
-// FBEncryptViewController.h
-// FBEncrypt
+// Copyright (c) 2011 Five-technology Co.,Ltd.
//
-// Created by Hiroshi Hashiguchi on 11/05/30.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
//
#import <UIKit/UIKit.h>
@@ -12,4 +26,14 @@
}
+@property (nonatomic, retain) IBOutlet UITextView* message;
+@property (nonatomic, retain) IBOutlet UITextView* encrypted;
+@property (nonatomic, retain) IBOutlet UITextView* decrypted;
+@property (nonatomic, retain) IBOutlet UITextField* key;
+@property (nonatomic, retain) IBOutlet UIScrollView* scrollView;
+@property (nonatomic, retain) IBOutlet UISwitch* separateline;
+
+- (IBAction)encrypt:(id)sender;
+- (IBAction)decrypt:(id)sender;
+
@end
@@ -1,15 +1,37 @@
//
-// FBEncryptViewController.m
-// FBEncrypt
+// Copyright (c) 2011 Five-technology Co.,Ltd.
//
-// Created by Hiroshi Hashiguchi on 11/05/30.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
//
#import "FBEncryptViewController.h"
+#import "FBEncryptorAES.h"
@implementation FBEncryptViewController
+@synthesize message;
+@synthesize encrypted;
+@synthesize decrypted;
+@synthesize key;
+@synthesize scrollView;
+@synthesize separateline;
+
- (void)dealloc
{
[super dealloc];
@@ -25,13 +47,12 @@ - (void)didReceiveMemoryWarning
#pragma mark - View lifecycle
-/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
+ self.scrollView.contentSize = CGSizeMake(320, 320+640);
}
-*/
- (void)viewDidUnload
{
@@ -46,4 +67,50 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
+- (IBAction)encrypt:(id)sender
+{
+ [FBEncryptorAES setBase64SeparateLines:[self.separateline isOn]];
+ self.encrypted.text = [FBEncryptorAES encryptBase64Message:self.message.text
+ keyString:self.key.text];
+ NSLog(@"encrypted: %@", self.encrypted.text);
+}
+
+- (IBAction)decrypt:(id)sender
+{
+ NSString* msg = [FBEncryptorAES decryptBase64Message:self.encrypted.text
+ keyString:self.key.text];
+
+ if (msg) {
+ self.decrypted.text = msg;
+ NSLog(@"decrypted: %@", msg);
+ } else {
+ self.decrypted.text = @"(failed to decrypt)";
+ }
+
+}
+
+
+/*
+- (IBAction)exg:(id)sender
+{
+ if (self.ivString == nil || [self.ivString.text length] == 0) {
+ return;
+ }
+ const char* ivPtr = [self.ivString.text cStringUsingEncoding:NSUTF8StringEncoding];
+ NSMutableString* str = [NSMutableString string];
+ int len = 0;
+ while (*ivPtr) {
+ [str appendFormat:@"%02X", *ivPtr];
+ len++;
+ ivPtr++;
+ }
+ while (len < 16) {
+ [str appendString:@"00"];
+ len++;
+ }
+ self.iv.text = str;
+ NSLog(@"iv: %@", str);
+}
+*/
+
@end
Oops, something went wrong.

0 comments on commit 412010a

Please sign in to comment.