From 8ef696d38cc44abcd117a39a5ddd5ca2fd9836c4 Mon Sep 17 00:00:00 2001 From: Kelp Date: Tue, 15 May 2012 06:33:32 +0800 Subject: [PATCH] first commit --- CocoaSecurity.xcodeproj/project.pbxproj | 469 ++++++++++++ .../contents.xcworkspacedata | 7 + .../UserInterfaceState.xcuserstate | Bin 0 -> 40863 bytes .../WorkspaceSettings.xcsettings | 10 + .../xcdebugger/Breakpoints.xcbkptlist | 5 + .../xcschemes/CocoaSecurity.xcscheme | 95 +++ .../xcschemes/xcschememanagement.plist | 27 + CocoaSecurity/.DS_Store | Bin 0 -> 6148 bytes CocoaSecurity/CocoaSecurity.h | 80 ++ CocoaSecurity/CocoaSecurity.m | 504 +++++++++++++ .../GTMBase64/CocoaSecurity-GTMBase64.h | 189 +++++ .../GTMBase64/CocoaSecurity-GTMBase64.m | 694 ++++++++++++++++++ .../GTMBase64/CocoaSecurity-GTMDefines.h | 253 +++++++ CocoaSecurityTests/.DS_Store | Bin 0 -> 6148 bytes .../CocoaSecurityTests-Info.plist | 22 + CocoaSecurityTests/CocoaSecurityTests.h | 14 + CocoaSecurityTests/CocoaSecurityTests.m | 134 ++++ CocoaSecurityTests/en.lproj/InfoPlist.strings | 2 + README.md | 0 iOS View/.DS_Store | Bin 0 -> 6148 bytes iOS View/CocoaSecurity-Info.plist | 40 + iOS View/CocoaSecurity-Prefix.pch | 14 + iOS View/CocoaSecurityAppDelegate.h | 15 + iOS View/CocoaSecurityAppDelegate.m | 54 ++ iOS View/CocoaSecurityViewController.h | 13 + iOS View/CocoaSecurityViewController.m | 34 + iOS View/en.lproj/InfoPlist.strings | 2 + iOS View/en.lproj/MainStoryboard.storyboard | 27 + iOS View/main.m | 18 + 29 files changed, 2722 insertions(+) create mode 100644 CocoaSecurity.xcodeproj/project.pbxproj create mode 100644 CocoaSecurity.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/WorkspaceSettings.xcsettings create mode 100644 CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist create mode 100644 CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/CocoaSecurity.xcscheme create mode 100644 CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 CocoaSecurity/.DS_Store create mode 100644 CocoaSecurity/CocoaSecurity.h create mode 100644 CocoaSecurity/CocoaSecurity.m create mode 100644 CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.h create mode 100644 CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.m create mode 100644 CocoaSecurity/GTMBase64/CocoaSecurity-GTMDefines.h create mode 100644 CocoaSecurityTests/.DS_Store create mode 100644 CocoaSecurityTests/CocoaSecurityTests-Info.plist create mode 100644 CocoaSecurityTests/CocoaSecurityTests.h create mode 100644 CocoaSecurityTests/CocoaSecurityTests.m create mode 100644 CocoaSecurityTests/en.lproj/InfoPlist.strings create mode 100644 README.md create mode 100644 iOS View/.DS_Store create mode 100644 iOS View/CocoaSecurity-Info.plist create mode 100644 iOS View/CocoaSecurity-Prefix.pch create mode 100644 iOS View/CocoaSecurityAppDelegate.h create mode 100644 iOS View/CocoaSecurityAppDelegate.m create mode 100644 iOS View/CocoaSecurityViewController.h create mode 100644 iOS View/CocoaSecurityViewController.m create mode 100644 iOS View/en.lproj/InfoPlist.strings create mode 100644 iOS View/en.lproj/MainStoryboard.storyboard create mode 100644 iOS View/main.m diff --git a/CocoaSecurity.xcodeproj/project.pbxproj b/CocoaSecurity.xcodeproj/project.pbxproj new file mode 100644 index 0000000..36f62d2 --- /dev/null +++ b/CocoaSecurity.xcodeproj/project.pbxproj @@ -0,0 +1,469 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 210D18E715606B4A0030DAFC /* CocoaSecurity.m in Sources */ = {isa = PBXBuildFile; fileRef = 210D18E215606B4A0030DAFC /* CocoaSecurity.m */; }; + 210D18E815606B4A0030DAFC /* CocoaSecurity-GTMBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 210D18E515606B4A0030DAFC /* CocoaSecurity-GTMBase64.m */; }; + 214A6FFB1560143B00D5E058 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 214A6FFA1560143B00D5E058 /* UIKit.framework */; }; + 214A6FFD1560143B00D5E058 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 214A6FFC1560143B00D5E058 /* Foundation.framework */; }; + 214A6FFF1560143B00D5E058 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 214A6FFE1560143B00D5E058 /* CoreGraphics.framework */; }; + 214A70191560143C00D5E058 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 214A70181560143C00D5E058 /* SenTestingKit.framework */; }; + 214A701A1560143C00D5E058 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 214A6FFA1560143B00D5E058 /* UIKit.framework */; }; + 214A701B1560143C00D5E058 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 214A6FFC1560143B00D5E058 /* Foundation.framework */; }; + 214A70231560143C00D5E058 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 214A70211560143C00D5E058 /* InfoPlist.strings */; }; + 214A70261560143C00D5E058 /* CocoaSecurityTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 214A70251560143C00D5E058 /* CocoaSecurityTests.m */; }; + 21BF43F61560657600F530DC /* CocoaSecurityAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 21BF43ED1560657600F530DC /* CocoaSecurityAppDelegate.m */; }; + 21BF43F71560657600F530DC /* CocoaSecurityViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 21BF43EF1560657600F530DC /* CocoaSecurityViewController.m */; }; + 21BF43F81560657600F530DC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 21BF43F01560657600F530DC /* InfoPlist.strings */; }; + 21BF43F91560657600F530DC /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 21BF43F21560657600F530DC /* MainStoryboard.storyboard */; }; + 21BF43FA1560657600F530DC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 21BF43F41560657600F530DC /* main.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 214A701C1560143C00D5E058 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 214A6FED1560143B00D5E058 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 214A6FF51560143B00D5E058; + remoteInfo = CocoaSecurity; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 210D18E115606B4A0030DAFC /* CocoaSecurity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaSecurity.h; sourceTree = ""; }; + 210D18E215606B4A0030DAFC /* CocoaSecurity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocoaSecurity.m; sourceTree = ""; }; + 210D18E415606B4A0030DAFC /* CocoaSecurity-GTMBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CocoaSecurity-GTMBase64.h"; sourceTree = ""; }; + 210D18E515606B4A0030DAFC /* CocoaSecurity-GTMBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CocoaSecurity-GTMBase64.m"; sourceTree = ""; }; + 210D18E615606B4A0030DAFC /* CocoaSecurity-GTMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CocoaSecurity-GTMDefines.h"; sourceTree = ""; }; + 214A6FF61560143B00D5E058 /* CocoaSecurity.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CocoaSecurity.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 214A6FFA1560143B00D5E058 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 214A6FFC1560143B00D5E058 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 214A6FFE1560143B00D5E058 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 214A70171560143C00D5E058 /* CocoaSecurityTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CocoaSecurityTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + 214A70181560143C00D5E058 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; + 214A70201560143C00D5E058 /* CocoaSecurityTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CocoaSecurityTests-Info.plist"; sourceTree = ""; }; + 214A70221560143C00D5E058 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 214A70241560143C00D5E058 /* CocoaSecurityTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CocoaSecurityTests.h; sourceTree = ""; }; + 214A70251560143C00D5E058 /* CocoaSecurityTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CocoaSecurityTests.m; sourceTree = ""; }; + 21BF43EA1560657600F530DC /* CocoaSecurity-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "CocoaSecurity-Info.plist"; sourceTree = ""; }; + 21BF43EB1560657600F530DC /* CocoaSecurity-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CocoaSecurity-Prefix.pch"; sourceTree = ""; }; + 21BF43EC1560657600F530DC /* CocoaSecurityAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaSecurityAppDelegate.h; sourceTree = ""; }; + 21BF43ED1560657600F530DC /* CocoaSecurityAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocoaSecurityAppDelegate.m; sourceTree = ""; }; + 21BF43EE1560657600F530DC /* CocoaSecurityViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaSecurityViewController.h; sourceTree = ""; }; + 21BF43EF1560657600F530DC /* CocoaSecurityViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocoaSecurityViewController.m; sourceTree = ""; }; + 21BF43F11560657600F530DC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 21BF43F31560657600F530DC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; + 21BF43F41560657600F530DC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 214A6FF31560143B00D5E058 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 214A6FFB1560143B00D5E058 /* UIKit.framework in Frameworks */, + 214A6FFD1560143B00D5E058 /* Foundation.framework in Frameworks */, + 214A6FFF1560143B00D5E058 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 214A70131560143C00D5E058 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 214A70191560143C00D5E058 /* SenTestingKit.framework in Frameworks */, + 214A701A1560143C00D5E058 /* UIKit.framework in Frameworks */, + 214A701B1560143C00D5E058 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 210D18E015606B4A0030DAFC /* CocoaSecurity */ = { + isa = PBXGroup; + children = ( + 210D18E115606B4A0030DAFC /* CocoaSecurity.h */, + 210D18E215606B4A0030DAFC /* CocoaSecurity.m */, + 210D18E315606B4A0030DAFC /* GTMBase64 */, + ); + path = CocoaSecurity; + sourceTree = ""; + }; + 210D18E315606B4A0030DAFC /* GTMBase64 */ = { + isa = PBXGroup; + children = ( + 210D18E415606B4A0030DAFC /* CocoaSecurity-GTMBase64.h */, + 210D18E515606B4A0030DAFC /* CocoaSecurity-GTMBase64.m */, + 210D18E615606B4A0030DAFC /* CocoaSecurity-GTMDefines.h */, + ); + path = GTMBase64; + sourceTree = ""; + }; + 214A6FEB1560143B00D5E058 = { + isa = PBXGroup; + children = ( + 210D18E015606B4A0030DAFC /* CocoaSecurity */, + 21BF43E91560657600F530DC /* iOS View */, + 214A701E1560143C00D5E058 /* CocoaSecurityTests */, + 214A6FF91560143B00D5E058 /* Frameworks */, + 214A6FF71560143B00D5E058 /* Products */, + ); + sourceTree = ""; + }; + 214A6FF71560143B00D5E058 /* Products */ = { + isa = PBXGroup; + children = ( + 214A6FF61560143B00D5E058 /* CocoaSecurity.app */, + 214A70171560143C00D5E058 /* CocoaSecurityTests.octest */, + ); + name = Products; + sourceTree = ""; + }; + 214A6FF91560143B00D5E058 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 214A6FFA1560143B00D5E058 /* UIKit.framework */, + 214A6FFC1560143B00D5E058 /* Foundation.framework */, + 214A6FFE1560143B00D5E058 /* CoreGraphics.framework */, + 214A70181560143C00D5E058 /* SenTestingKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 214A701E1560143C00D5E058 /* CocoaSecurityTests */ = { + isa = PBXGroup; + children = ( + 214A70241560143C00D5E058 /* CocoaSecurityTests.h */, + 214A70251560143C00D5E058 /* CocoaSecurityTests.m */, + 214A701F1560143C00D5E058 /* Supporting Files */, + ); + path = CocoaSecurityTests; + sourceTree = ""; + }; + 214A701F1560143C00D5E058 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 214A70201560143C00D5E058 /* CocoaSecurityTests-Info.plist */, + 214A70211560143C00D5E058 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 21BF43E91560657600F530DC /* iOS View */ = { + isa = PBXGroup; + children = ( + 21BF43EA1560657600F530DC /* CocoaSecurity-Info.plist */, + 21BF43EB1560657600F530DC /* CocoaSecurity-Prefix.pch */, + 21BF43EC1560657600F530DC /* CocoaSecurityAppDelegate.h */, + 21BF43ED1560657600F530DC /* CocoaSecurityAppDelegate.m */, + 21BF43EE1560657600F530DC /* CocoaSecurityViewController.h */, + 21BF43EF1560657600F530DC /* CocoaSecurityViewController.m */, + 21BF43F01560657600F530DC /* InfoPlist.strings */, + 21BF43F21560657600F530DC /* MainStoryboard.storyboard */, + 21BF43F41560657600F530DC /* main.m */, + ); + path = "iOS View"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 214A6FF51560143B00D5E058 /* CocoaSecurity */ = { + isa = PBXNativeTarget; + buildConfigurationList = 214A70291560143C00D5E058 /* Build configuration list for PBXNativeTarget "CocoaSecurity" */; + buildPhases = ( + 214A6FF21560143B00D5E058 /* Sources */, + 214A6FF31560143B00D5E058 /* Frameworks */, + 214A6FF41560143B00D5E058 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CocoaSecurity; + productName = CocoaSecurity; + productReference = 214A6FF61560143B00D5E058 /* CocoaSecurity.app */; + productType = "com.apple.product-type.application"; + }; + 214A70161560143C00D5E058 /* CocoaSecurityTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 214A702C1560143C00D5E058 /* Build configuration list for PBXNativeTarget "CocoaSecurityTests" */; + buildPhases = ( + 214A70121560143C00D5E058 /* Sources */, + 214A70131560143C00D5E058 /* Frameworks */, + 214A70141560143C00D5E058 /* Resources */, + 214A70151560143C00D5E058 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 214A701D1560143C00D5E058 /* PBXTargetDependency */, + ); + name = CocoaSecurityTests; + productName = CocoaSecurityTests; + productReference = 214A70171560143C00D5E058 /* CocoaSecurityTests.octest */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 214A6FED1560143B00D5E058 /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = CocoaSecurity; + LastUpgradeCheck = 0430; + }; + buildConfigurationList = 214A6FF01560143B00D5E058 /* Build configuration list for PBXProject "CocoaSecurity" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 214A6FEB1560143B00D5E058; + productRefGroup = 214A6FF71560143B00D5E058 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 214A6FF51560143B00D5E058 /* CocoaSecurity */, + 214A70161560143C00D5E058 /* CocoaSecurityTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 214A6FF41560143B00D5E058 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 21BF43F81560657600F530DC /* InfoPlist.strings in Resources */, + 21BF43F91560657600F530DC /* MainStoryboard.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 214A70141560143C00D5E058 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 214A70231560143C00D5E058 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 214A70151560143C00D5E058 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 214A6FF21560143B00D5E058 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 21BF43F61560657600F530DC /* CocoaSecurityAppDelegate.m in Sources */, + 21BF43F71560657600F530DC /* CocoaSecurityViewController.m in Sources */, + 21BF43FA1560657600F530DC /* main.m in Sources */, + 210D18E715606B4A0030DAFC /* CocoaSecurity.m in Sources */, + 210D18E815606B4A0030DAFC /* CocoaSecurity-GTMBase64.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 214A70121560143C00D5E058 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 214A70261560143C00D5E058 /* CocoaSecurityTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 214A701D1560143C00D5E058 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 214A6FF51560143B00D5E058 /* CocoaSecurity */; + targetProxy = 214A701C1560143C00D5E058 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 214A70211560143C00D5E058 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 214A70221560143C00D5E058 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 21BF43F01560657600F530DC /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 21BF43F11560657600F530DC /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 21BF43F21560657600F530DC /* MainStoryboard.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 21BF43F31560657600F530DC /* en */, + ); + name = MainStoryboard.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 214A70271560143C00D5E058 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = ""; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 214A70281560143C00D5E058 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = ""; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 214A702A1560143C00D5E058 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOS View/CocoaSecurity-Prefix.pch"; + INFOPLIST_FILE = "iOS View/CocoaSecurity-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 214A702B1560143C00D5E058 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOS View/CocoaSecurity-Prefix.pch"; + INFOPLIST_FILE = "iOS View/CocoaSecurity-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 214A702D1560143C00D5E058 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CocoaSecurity.app/CocoaSecurity"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOS View/CocoaSecurity-Prefix.pch"; + INFOPLIST_FILE = "CocoaSecurityTests/CocoaSecurityTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + 214A702E1560143C00D5E058 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CocoaSecurity.app/CocoaSecurity"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOS View/CocoaSecurity-Prefix.pch"; + INFOPLIST_FILE = "CocoaSecurityTests/CocoaSecurityTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = octest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 214A6FF01560143B00D5E058 /* Build configuration list for PBXProject "CocoaSecurity" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 214A70271560143C00D5E058 /* Debug */, + 214A70281560143C00D5E058 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 214A70291560143C00D5E058 /* Build configuration list for PBXNativeTarget "CocoaSecurity" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 214A702A1560143C00D5E058 /* Debug */, + 214A702B1560143C00D5E058 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 214A702C1560143C00D5E058 /* Build configuration list for PBXNativeTarget "CocoaSecurityTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 214A702D1560143C00D5E058 /* Debug */, + 214A702E1560143C00D5E058 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 214A6FED1560143B00D5E058 /* Project object */; +} diff --git a/CocoaSecurity.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CocoaSecurity.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..12756e6 --- /dev/null +++ b/CocoaSecurity.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/UserInterfaceState.xcuserstate b/CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..9d1809a24609feff68b6329abb6dd6d323ab70a2 GIT binary patch literal 40863 zcmdpf2Y3@l)Bo*CI_ZSLHn5WwWvv*cAHZSCTzxR8-KhJ|LpJsnMJ3BiwJ6o=~yQ96g zFDvT+gBZ+67%3xTSmkZXU3Do-T|K?+?ykBNck?1wOJ8q&N>fkE!ghGUZ#)fXO=Q&G8ZyeF;_F2m>Zd!n61nX=4R$rW({*2a~E?T^APhW z^Ca^evzK|5+0VSgyvuyd9Av&?jxt{}-!MNQDUu-;$&mtaNQp+FAT$<5p;$B?O+ZO# zB2pnW(x5z~Mfqq3nu!Wg5h_LoWJD%ZifpI~)u3ABLJLqET8P@2wP+FQMoZ8#v>cs@ z&O+y+i_s-$9l8`zQnZ=es*hv-Z6 z6*`K(M&DotBaE>GOR)^ISdJBV3=YQOI0DDvB%F+=;7nYAXW*IGgiCN4uEY(v5zoPM z@jUFr{dg%}hL__N_zb)fufnVGnfNSxHa-tufG@_E;w$h5d;{K&ci@}x9r#Xs7k&so zj32>o;h5b0za6&5{cx z>m-*;u9j?&Tqn6vvPH68a*Je_2m1`=^4_M(zVj_r58vqlwKoU zFWn&BDBULAF5Mx$TY8W5Ug>?(`=t*^ACx{MeOCIM^m*wE(l?}UO5c(ml71@vOnO-Q zgY-w~Ptu>Izes}>`bn}kcv11P;x)y7#hZ$E6z?lOQhcKLO!0-{E5$d8?-f5OepURg_={sW z3CD6A7sLf~W4UlHii_pOa}&4}ZW1?@OXsq?9s3!MQ8J^LAZ9cZQj^ls(bU^p zTVc;w>{`*=0KW%a1wU^yGlmJ~F)!K7gfe4!DgUxFB*myV8Fi|xymYn6P?E0FXX(=Q zMni78N|S9c>U1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2`>+NN;$b|BC-5Ym!L#@$He(C6Vw;(6zBG$Wz9}$27;B2ndb82|Xv$25 z*>0*$jj1(<%n{RIel_=Px*ccp>_WTDdKRs*kzHp??O}Vw{$@|wGq%ZIvp4K*d)Kzu zN4C|r*%$Vei@7v6&nHp9CpdO_l;m(i$qFGTK7hsFJGa=b%@R5o88~gQ3Cb;KQIK*b;0F zDubPgS&0RSZxV|Vi^D$Qpm10N#v)BH2zHc<_EoMJjasU7T literal 0 HcmV?d00001 diff --git a/CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/WorkspaceSettings.xcsettings b/CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..659c876 --- /dev/null +++ b/CocoaSecurity.xcodeproj/project.xcworkspace/xcuserdata/Kelp.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + + SnapshotAutomaticallyBeforeSignificantChanges + + + diff --git a/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 0000000..05301bc --- /dev/null +++ b/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/CocoaSecurity.xcscheme b/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/CocoaSecurity.xcscheme new file mode 100644 index 0000000..ecc1935 --- /dev/null +++ b/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/CocoaSecurity.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/xcschememanagement.plist b/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..42f4d2c --- /dev/null +++ b/CocoaSecurity.xcodeproj/xcuserdata/Kelp.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + CocoaSecurity.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 214A6FF51560143B00D5E058 + + primary + + + 214A70161560143C00D5E058 + + primary + + + + + diff --git a/CocoaSecurity/.DS_Store b/CocoaSecurity/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..495a72ba2db70ccfb5da64ca3ccfa4709423f6d1 GIT binary patch literal 6148 zcmeHK%}T>S5T0$Twy4mHptr?yk;ayK@eo2pFM^Ol4^}j3iY>I=(xmiIq7e_ifoC5< zpTmm>@p+v6QIyt`AX4UonQxe#N!TxCw*vso8HW}?5diXNk~0N#b0F8H%^+hkS!AZ3 z;X?#%s6jQD%v4k2KPn)%cE4#(iYm+u!1gPsU*^)VRsx=~y%zp+dG^aqP$A$ni&N<;0IWxT4~^5Iu~Wrn=D$0 zf2hmuALdu}h3kgnxCQY1`tqb}$&&)404cC=3YZf#zq)WcqYaS)q`+?#kmmzOlWZGK zHLIfoof-j^m>E8pc{4K; z3R7>#=W|sK%+^ev6d(n@DzW39Z3H_;R@&t-sY8%{N220?!WlnmrZfj?E?9j%j6qW}N^ literal 0 HcmV?d00001 diff --git a/CocoaSecurity/CocoaSecurity.h b/CocoaSecurity/CocoaSecurity.h new file mode 100644 index 0000000..2aec8e5 --- /dev/null +++ b/CocoaSecurity/CocoaSecurity.h @@ -0,0 +1,80 @@ +// +// CocoaSecurity.h +// +// Created by Kelp on 12/5/12. +// Copyright (c) 2012 Kelp http://kelp.phate.org/ +// + +#import +#import +#import "CocoaSecurity-GTMBase64.h" +#import +#import + +#pragma mark - CocoaSecurityResult +@interface CocoaSecurityResult : NSObject +@property (retain) NSData *data; +@property (retain, readonly) NSString *utf8String; +@property (retain, readonly) NSString *hex; +@property (retain, readonly) NSString *hexLower; +@property (retain, readonly) NSString *base64; + +- (id)initWithBytes: (unsigned char[])initData length: (uint) length; +@end + + +#pragma mark - CocoaSecurity +@interface CocoaSecurity : NSObject +#pragma mark - AES Encrypt +- (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSString *)key; +- (CocoaSecurityResult *)aesEncrypt:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv; +- (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSData *)key iv:(NSData *)iv; +- (CocoaSecurityResult *)aesEncryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv; +#pragma mark AES Decrypt +- (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSString *)key; +- (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv; +- (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSData *)key iv:(NSData *)iv; +- (CocoaSecurityResult *)aesDecryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv; + +#pragma mark - MD5 +- (CocoaSecurityResult *)md5: (NSString *)hashString; +- (CocoaSecurityResult *)md5WithData: (NSData *)hashData; +#pragma mark HMAC-MD5 +- (CocoaSecurityResult *)hmacMd5: (NSString *)hashString hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacMd5WithData: (NSData *)hashData hmacKey:(NSString *)key; + +#pragma mark - SHA +- (CocoaSecurityResult *)sha1: (NSString *)hashString; +- (CocoaSecurityResult *)sha1WithData: (NSData *)hashData; +- (CocoaSecurityResult *)sha224: (NSString *)hashString; +- (CocoaSecurityResult *)sha224WithData: (NSData *)hashData; +- (CocoaSecurityResult *)sha256: (NSString *)hashString; +- (CocoaSecurityResult *)sha256WithData: (NSData *)hashData; +- (CocoaSecurityResult *)sha384: (NSString *)hashString; +- (CocoaSecurityResult *)sha384WithData: (NSData *)hashData; +- (CocoaSecurityResult *)sha512: (NSString *)hashString; +- (CocoaSecurityResult *)sha512WithData: (NSData *)hashData; +#pragma mark HMAC-SHA +- (CocoaSecurityResult *)hmacSha1: (NSString *)hashString hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha1WithData: (NSData *)hashData hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha224: (NSString *)hashString hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha224WithData: (NSData *)hashData hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha256: (NSString *)hashString hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha256WithData: (NSData *)hashData hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha384: (NSString *)hashString hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha384WithData: (NSData *)hashData hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha512: (NSString *)hashString hmacKey:(NSString *)key; +- (CocoaSecurityResult *)hmacSha512WithData: (NSData *)hashData hmacKey:(NSString *)key; +@end + + +#pragma mark - CocoaSecurityEncoder +@interface CocoaSecurityEncoder : NSObject +- (NSString *)base64: (NSData *)data; +- (NSString *)hex: (NSData *)data useLower: (bool)isOutputLower; +@end +#pragma mark - CocoaSecurityDecoder +@interface CocoaSecurityDecoder : NSObject +- (NSData *)base64: (NSString *)data; +- (NSData *)hex: (NSString *)data; +@end diff --git a/CocoaSecurity/CocoaSecurity.m b/CocoaSecurity/CocoaSecurity.m new file mode 100644 index 0000000..b0475e6 --- /dev/null +++ b/CocoaSecurity/CocoaSecurity.m @@ -0,0 +1,504 @@ +// +// CocoaSecurity.m +// +// Created by Kelp on 12/5/12. +// Copyright (c) 2012 Kelp http://kelp.phate.org/ +// + +#import "CocoaSecurity.h" + +#pragma mark - CocoaSecurity +@implementation CocoaSecurity + +#pragma mark - AES Encrypt +// default AES Encrypt, key -> SHA384(key).sub(0, 32), iv -> SHA384(key).sub(32, 16) +- (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSString *)key +{ + CocoaSecurityResult * sha = [self sha384:key]; + NSData *aesKey = [sha.data subdataWithRange:NSMakeRange(0, 32)]; + NSData *aesIv = [sha.data subdataWithRange:NSMakeRange(32, 16)]; + + return [self aesEncrypt:data key:aesKey iv:aesIv]; +} +#pragma mark AES Encrypt 128, 192, 256 +- (CocoaSecurityResult *)aesEncrypt:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv +{ + CocoaSecurityDecoder *decoder = [[CocoaSecurityDecoder alloc] init]; + NSData *aesKey = [decoder hex:key]; + NSData *aesIv = [decoder hex:iv]; + [decoder release]; + + return [self aesEncrypt:data key:aesKey iv:aesIv]; +} +- (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSData *)key iv:(NSData *)iv +{ + return [self aesEncryptWithData:[data dataUsingEncoding:NSUTF8StringEncoding] key:key iv:iv]; +} +- (CocoaSecurityResult *)aesEncryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv +{ + // check length of key and iv + if ([iv length] != 16) { + @throw [NSException exceptionWithName:@"Cocoa Security" + reason:@"Length of iv is wrong. Length of iv should be 16(128bits)" + userInfo:nil]; + } + if ([key length] != 16 && [key length] != 24 && [key length] != 32 ) { + @throw [NSException exceptionWithName:@"Cocoa Security" + reason:@"Length of key is wrong. Length of iv should be 16, 24 or 32(128, 192 or 256bits)" + userInfo:nil]; + } + + // setup output buffer + size_t bufferSize = [data length] + kCCBlockSizeAES128; + void *buffer = malloc(bufferSize); + + // do encrypt + size_t encryptedSize = 0; + CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt, + kCCAlgorithmAES128, + kCCOptionPKCS7Padding, + [key bytes], // Key + [key length], // kCCKeySizeAES + [iv bytes], // IV + [data bytes], + [data length], + buffer, + bufferSize, + &encryptedSize); + if (cryptStatus == kCCSuccess) { + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:buffer length:encryptedSize] autorelease]; + free(buffer); + + return result; + } else { + free(buffer); + @throw [NSException exceptionWithName:@"Cocoa Security" + reason:@"Encrypt Error!" + userInfo:nil]; + return nil; + } +} +#pragma mark AES Decrypt 128, 192, 256 +// default AES Decrypt, key -> SHA384(key).sub(0, 32), iv -> SHA384(key).sub(32, 16) +- (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSString *)key +{ + CocoaSecurityResult * sha = [self sha384:key]; + NSData *aesKey = [sha.data subdataWithRange:NSMakeRange(0, 32)]; + NSData *aesIv = [sha.data subdataWithRange:NSMakeRange(32, 16)]; + + return [self aesDecryptWithBase64:data key:aesKey iv:aesIv]; +} +#pragma mark AES Encrypt 128, 192, 256 +- (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv +{ + CocoaSecurityDecoder *decoder = [[CocoaSecurityDecoder alloc] init]; + NSData *aesKey = [decoder hex:key]; + NSData *aesIv = [decoder hex:iv]; + [decoder release]; + + return [self aesDecryptWithBase64:data key:aesKey iv:aesIv]; +} +- (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSData *)key iv:(NSData *)iv +{ + CocoaSecurityDecoder *decoder = [[[CocoaSecurityDecoder alloc] init] autorelease]; + + return [self aesDecryptWithData:[decoder base64:data] key:key iv:iv]; +} +- (CocoaSecurityResult *)aesDecryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv +{ + // check length of key and iv + if ([iv length] != 16) { + @throw [NSException exceptionWithName:@"Cocoa Security" + reason:@"Length of iv is wrong. Length of iv should be 16(128bits)" + userInfo:nil]; + } + if ([key length] != 16 && [key length] != 24 && [key length] != 32 ) { + @throw [NSException exceptionWithName:@"Cocoa Security" + reason:@"Length of key is wrong. Length of iv should be 16, 24 or 32(128, 192 or 256bits)" + userInfo:nil]; + } + + // setup output buffer + size_t bufferSize = [data length] + kCCBlockSizeAES128; + void *buffer = malloc(bufferSize); + + // do encrypt + size_t encryptedSize = 0; + CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt, + kCCAlgorithmAES128, + kCCOptionPKCS7Padding, + [key bytes], // Key + [key length], // kCCKeySizeAES + [iv bytes], // IV + [data bytes], + [data length], + buffer, + bufferSize, + &encryptedSize); + if (cryptStatus == kCCSuccess) { + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:buffer length:encryptedSize] autorelease]; + free(buffer); + + return result; + } else { + free(buffer); + @throw [NSException exceptionWithName:@"Cocoa Security" + reason:@"Decrypt Error!" + userInfo:nil]; + return nil; + } +} + +#pragma mark - MD5 +- (CocoaSecurityResult *)md5:(NSString *)hashString +{ + return [self md5WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]]; +} +- (CocoaSecurityResult *)md5WithData:(NSData *)hashData +{ + unsigned char *digest; + digest = malloc(CC_MD5_DIGEST_LENGTH); + + CC_MD5([hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_MD5_DIGEST_LENGTH] autorelease]; + free(digest); + + return result; +} +#pragma mark - HMAC-MD5 +- (CocoaSecurityResult *)hmacMd5:(NSString *)hashString hmacKey:(NSString *)key +{ + return [self hmacMd5WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key]; +} +- (CocoaSecurityResult *)hmacMd5WithData:(NSData *)hashData hmacKey:(NSString *)key +{ + unsigned char *digest; + digest = malloc(CC_MD5_DIGEST_LENGTH); + const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding]; + + CCHmac(kCCHmacAlgMD5, cKey, strlen(cKey), [hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_MD5_DIGEST_LENGTH] autorelease]; + free(digest); + cKey = nil; + + return result; +} + +#pragma mark - SHA1 +- (CocoaSecurityResult *)sha1:(NSString *)hashString +{ + return [self sha1WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]]; +} +- (CocoaSecurityResult *)sha1WithData:(NSData *)hashData +{ + unsigned char *digest; + digest = malloc(CC_SHA1_DIGEST_LENGTH); + + CC_SHA1([hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA1_DIGEST_LENGTH] autorelease]; + free(digest); + + return result; +} +#pragma mark SHA224 +- (CocoaSecurityResult *)sha224:(NSString *)hashString +{ + return [self sha224WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]]; +} +- (CocoaSecurityResult *)sha224WithData:(NSData *)hashData +{ + unsigned char *digest; + digest = malloc(CC_SHA224_DIGEST_LENGTH); + + CC_SHA224([hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA224_DIGEST_LENGTH] autorelease]; + free(digest); + + return result; +} +#pragma mark SHA256 +- (CocoaSecurityResult *)sha256:(NSString *)hashString +{ + return [self sha256WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]]; +} +- (CocoaSecurityResult *)sha256WithData:(NSData *)hashData +{ + unsigned char *digest; + digest = malloc(CC_SHA256_DIGEST_LENGTH); + + CC_SHA256([hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA256_DIGEST_LENGTH] autorelease]; + free(digest); + + return result; +} +#pragma mark SHA384 +- (CocoaSecurityResult *)sha384:(NSString *)hashString +{ + return [self sha384WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]]; +} +- (CocoaSecurityResult *)sha384WithData:(NSData *)hashData +{ + unsigned char *digest; + digest = malloc(CC_SHA384_DIGEST_LENGTH); + + CC_SHA384([hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA384_DIGEST_LENGTH] autorelease]; + free(digest); + + return result; +} +#pragma mark SHA512 +- (CocoaSecurityResult *)sha512:(NSString *)hashString +{ + return [self sha512WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]]; +} +- (CocoaSecurityResult *)sha512WithData:(NSData *)hashData +{ + unsigned char *digest; + digest = malloc(CC_SHA512_DIGEST_LENGTH); + + CC_SHA512([hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA512_DIGEST_LENGTH] autorelease]; + free(digest); + + return result; +} + +#pragma mark - HMAC-SHA1 +- (CocoaSecurityResult *)hmacSha1:(NSString *)hashString hmacKey:(NSString *)key +{ + return [self hmacSha1WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key]; +} +- (CocoaSecurityResult *)hmacSha1WithData:(NSData *)hashData hmacKey:(NSString *)key +{ + unsigned char *digest; + digest = malloc(CC_SHA1_DIGEST_LENGTH); + const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding]; + + CCHmac(kCCHmacAlgSHA1, cKey, strlen(cKey), [hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA1_DIGEST_LENGTH] autorelease]; + free(digest); + cKey = nil; + + return result; +} +#pragma mark HMAC-SHA224 +- (CocoaSecurityResult *)hmacSha224:(NSString *)hashString hmacKey:(NSString *)key +{ + return [self hmacSha224WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key]; +} +- (CocoaSecurityResult *)hmacSha224WithData:(NSData *)hashData hmacKey:(NSString *)key +{ + unsigned char *digest; + digest = malloc(CC_SHA224_DIGEST_LENGTH); + const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding]; + + CCHmac(kCCHmacAlgSHA224, cKey, strlen(cKey), [hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA224_DIGEST_LENGTH] autorelease]; + free(digest); + cKey = nil; + + return result; +} +#pragma mark HMAC-SHA256 +- (CocoaSecurityResult *)hmacSha256:(NSString *)hashString hmacKey:(NSString *)key +{ + return [self hmacSha256WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key]; +} +- (CocoaSecurityResult *)hmacSha256WithData:(NSData *)hashData hmacKey:(NSString *)key +{ + unsigned char *digest; + digest = malloc(CC_SHA256_DIGEST_LENGTH); + const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding]; + + CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), [hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA256_DIGEST_LENGTH] autorelease]; + free(digest); + cKey = nil; + + return result; +} +#pragma mark HMAC-SHA384 +- (CocoaSecurityResult *)hmacSha384:(NSString *)hashString hmacKey:(NSString *)key +{ + return [self hmacSha384WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key]; +} +- (CocoaSecurityResult *)hmacSha384WithData:(NSData *)hashData hmacKey:(NSString *)key +{ + unsigned char *digest; + digest = malloc(CC_SHA384_DIGEST_LENGTH); + const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding]; + + CCHmac(kCCHmacAlgSHA384, cKey, strlen(cKey), [hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA384_DIGEST_LENGTH] autorelease]; + free(digest); + cKey = nil; + + return result; +} +#pragma mark HMAC-SHA512 +- (CocoaSecurityResult *)hmacSha512:(NSString *)hashString hmacKey:(NSString *)key +{ + return [self hmacSha512WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key]; +} +- (CocoaSecurityResult *)hmacSha512WithData:(NSData *)hashData hmacKey:(NSString *)key +{ + unsigned char *digest; + digest = malloc(CC_SHA512_DIGEST_LENGTH); + const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding]; + + CCHmac(kCCHmacAlgSHA512, cKey, strlen(cKey), [hashData bytes], [hashData length], digest); + CocoaSecurityResult *result = [[[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA512_DIGEST_LENGTH] autorelease]; + free(digest); + cKey = nil; + + return result; +} + +@end + + +#pragma mark - CocoaSecurityResult +@implementation CocoaSecurityResult + +- (id)initWithBytes: (unsigned char[])initData length: (uint) length +{ + self.data = [NSData dataWithBytes:initData length:length]; + + return self; +} + +#pragma mark - NSData +@synthesize data; + +#pragma mark UTF8 String +// convert CocoaSecurityResult to UTF8 string +- (NSString *)utf8String +{ + NSString *result = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; + + return result; +} + +#pragma mark HEX +// convert CocoaSecurityResult to HEX string +- (NSString *)hex +{ + CocoaSecurityEncoder *encoder = [[[CocoaSecurityEncoder alloc] init] autorelease]; + + return [encoder hex:data useLower:false]; +} +- (NSString *)hexLower +{ + CocoaSecurityEncoder *encoder = [[[CocoaSecurityEncoder alloc] init] autorelease]; + + return [encoder hex:data useLower:true]; +} + +#pragma mark Base64 +// convert CocoaSecurityResult to Base64 string +- (NSString *)base64 +{ + CocoaSecurityEncoder *encoder = [[[CocoaSecurityEncoder alloc] init] autorelease]; + + return [encoder base64:data]; +} + +@end + + +#pragma mark - CocoaSecurityEncoder +@implementation CocoaSecurityEncoder + +// convert NSData to Base64 +- (NSString *)base64: (NSData *)data +{ + // base on GTMBase64 + NSString *result = [[NSString alloc] initWithData:[GTMBase64 encodeData:data] encoding:NSUTF8StringEncoding]; + return [result autorelease]; +} + +// convert NSData to hex string +- (NSString *)hex: (NSData *)data useLower: (bool)isOutputLower +{ + static const char HexEncodeCharsLower[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + static const char HexEncodeChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + char *resultData; + // malloc result data + resultData = malloc([data length] * 2 +1); + // convert imgData(NSData) to char[] + unsigned char *sourceData = ((unsigned char *)[data bytes]); + uint length = [data length]; + + if (isOutputLower) { + for (uint index = 0; index < length; index++) { + // set result data + resultData[index * 2] = HexEncodeCharsLower[(sourceData[index] >> 4)]; + resultData[index * 2 + 1] = HexEncodeCharsLower[(sourceData[index] % 0x10)]; + } + } + else { + for (uint index = 0; index < length; index++) { + // set result data + resultData[index * 2] = HexEncodeChars[(sourceData[index] >> 4)]; + resultData[index * 2 + 1] = HexEncodeChars[(sourceData[index] % 0x10)]; + } + } + resultData[[data length] * 2] = 0; + + // convert result(char[]) to NSString + NSString *result = [NSString stringWithCString:resultData encoding:NSASCIIStringEncoding]; + sourceData = nil; + free(resultData); + + return result; +} + +@end + +#pragma mark - CocoaSecurityDecoder +@implementation CocoaSecurityDecoder + +- (NSData *)base64:(NSString *)data +{ + // base on GTMBase64 + NSData *result = [[NSData alloc] initWithData:[GTMBase64 decodeString:data]]; + return [result autorelease]; +} + +- (NSData *)hex: (NSString *)data +{ + static const unsigned char HexDecodeChars[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, //49 + 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, //59 + 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, + 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, //79 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, //99 + 13, 14, 15 + }; + + // convert data(NSString) to CString + const char *source = [data cStringUsingEncoding:NSUTF8StringEncoding]; + // malloc buffer + unsigned char *buffer; + uint length = strlen(source) / 2; + buffer = malloc(length); + for (uint index = 0; index < length; index++) { + buffer[index] = (HexDecodeChars[source[index * 2]] << 4) + (HexDecodeChars[source[index * 2 + 1]]); + } + // init result NSData + NSData *result = [NSData dataWithBytes:buffer length:length]; + free(buffer); + source = nil; + + return result; +} + +@end diff --git a/CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.h b/CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.h new file mode 100644 index 0000000..b6f9efb --- /dev/null +++ b/CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.h @@ -0,0 +1,189 @@ +// +// GTMBase64.h +// +// Copyright 2006-2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. +// + + +// WARNING: This class provides a subset of the functionality available in +// GTMStringEncoding and may go away in the future. +// Please consider using GTMStringEncoding instead. + + +#import +#import "CocoaSecurity-GTMDefines.h" + +// GTMBase64 +// +/// Helper for handling Base64 and WebSafeBase64 encodings +// +/// The webSafe methods use different character set and also the results aren't +/// always padded to a multiple of 4 characters. This is done so the resulting +/// data can be used in urls and url query arguments without needing any +/// encoding. You must use the webSafe* methods together, the data does not +/// interop with the RFC methods. +// +@interface GTMBase64 : NSObject + +// +// Standard Base64 (RFC) handling +// + +// encodeData: +// +/// Base64 encodes contents of the NSData object. +// +/// Returns: +/// A new autoreleased NSData with the encoded payload. nil for any error. +// ++(NSData *)encodeData:(NSData *)data; + +// decodeData: +// +/// Base64 decodes contents of the NSData object. +// +/// Returns: +/// A new autoreleased NSData with the decoded payload. nil for any error. +// ++(NSData *)decodeData:(NSData *)data; + +// encodeBytes:length: +// +/// Base64 encodes the data pointed at by |bytes|. +// +/// Returns: +/// A new autoreleased NSData with the encoded payload. nil for any error. +// ++(NSData *)encodeBytes:(const void *)bytes length:(NSUInteger)length; + +// decodeBytes:length: +// +/// Base64 decodes the data pointed at by |bytes|. +// +/// Returns: +/// A new autoreleased NSData with the encoded payload. nil for any error. +// ++(NSData *)decodeBytes:(const void *)bytes length:(NSUInteger)length; + +// stringByEncodingData: +// +/// Base64 encodes contents of the NSData object. +// +/// Returns: +/// A new autoreleased NSString with the encoded payload. nil for any error. +// ++(NSString *)stringByEncodingData:(NSData *)data; + +// stringByEncodingBytes:length: +// +/// Base64 encodes the data pointed at by |bytes|. +// +/// Returns: +/// A new autoreleased NSString with the encoded payload. nil for any error. +// ++(NSString *)stringByEncodingBytes:(const void *)bytes length:(NSUInteger)length; + +// decodeString: +// +/// Base64 decodes contents of the NSString. +// +/// Returns: +/// A new autoreleased NSData with the decoded payload. nil for any error. +// ++(NSData *)decodeString:(NSString *)string; + +// +// Modified Base64 encoding so the results can go onto urls. +// +// The changes are in the characters generated and also allows the result to +// not be padded to a multiple of 4. +// Must use the matching call to encode/decode, won't interop with the +// RFC versions. +// + +// webSafeEncodeData:padded: +// +/// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES +/// then padding characters are added so the result length is a multiple of 4. +// +/// Returns: +/// A new autoreleased NSData with the encoded payload. nil for any error. +// ++(NSData *)webSafeEncodeData:(NSData *)data + padded:(BOOL)padded; + +// webSafeDecodeData: +// +/// WebSafe Base64 decodes contents of the NSData object. +// +/// Returns: +/// A new autoreleased NSData with the decoded payload. nil for any error. +// ++(NSData *)webSafeDecodeData:(NSData *)data; + +// webSafeEncodeBytes:length:padded: +// +/// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES +/// then padding characters are added so the result length is a multiple of 4. +// +/// Returns: +/// A new autoreleased NSData with the encoded payload. nil for any error. +// ++(NSData *)webSafeEncodeBytes:(const void *)bytes + length:(NSUInteger)length + padded:(BOOL)padded; + +// webSafeDecodeBytes:length: +// +/// WebSafe Base64 decodes the data pointed at by |bytes|. +// +/// Returns: +/// A new autoreleased NSData with the encoded payload. nil for any error. +// ++(NSData *)webSafeDecodeBytes:(const void *)bytes length:(NSUInteger)length; + +// stringByWebSafeEncodingData:padded: +// +/// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES +/// then padding characters are added so the result length is a multiple of 4. +// +/// Returns: +/// A new autoreleased NSString with the encoded payload. nil for any error. +// ++(NSString *)stringByWebSafeEncodingData:(NSData *)data + padded:(BOOL)padded; + +// stringByWebSafeEncodingBytes:length:padded: +// +/// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES +/// then padding characters are added so the result length is a multiple of 4. +// +/// Returns: +/// A new autoreleased NSString with the encoded payload. nil for any error. +// ++(NSString *)stringByWebSafeEncodingBytes:(const void *)bytes + length:(NSUInteger)length + padded:(BOOL)padded; + +// webSafeDecodeString: +// +/// WebSafe Base64 decodes contents of the NSString. +// +/// Returns: +/// A new autoreleased NSData with the decoded payload. nil for any error. +// ++(NSData *)webSafeDecodeString:(NSString *)string; + +@end diff --git a/CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.m b/CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.m new file mode 100644 index 0000000..cb1a0c9 --- /dev/null +++ b/CocoaSecurity/GTMBase64/CocoaSecurity-GTMBase64.m @@ -0,0 +1,694 @@ +// +// GTMBase64.m +// +// Copyright 2006-2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. +// + +#import "CocoaSecurity-GTMBase64.h" +#import "CocoaSecurity-GTMDefines.h" + +static const char *kBase64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char *kWebSafeBase64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; +static const char kBase64PaddingChar = '='; +static const char kBase64InvalidChar = 99; + +static const char kBase64DecodeChars[] = { + // This array was generated by the following code: + // #include + // #include + // #include + // main() + // { + // static const char Base64[] = + // "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + // char *pos; + // int idx, i, j; + // printf(" "); + // for (i = 0; i < 255; i += 8) { + // for (j = i; j < i + 8; j++) { + // pos = strchr(Base64, j); + // if ((pos == NULL) || (j == 0)) + // idx = 99; + // else + // idx = pos - Base64; + // if (idx == 99) + // printf(" %2d, ", idx); + // else + // printf(" %2d/*%c*/,", idx, j); + // } + // printf("\n "); + // } + // } + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 62/*+*/, 99, 99, 99, 63/*/ */, + 52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/, + 60/*8*/, 61/*9*/, 99, 99, 99, 99, 99, 99, + 99, 0/*A*/, 1/*B*/, 2/*C*/, 3/*D*/, 4/*E*/, 5/*F*/, 6/*G*/, + 7/*H*/, 8/*I*/, 9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/, + 15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/, + 23/*X*/, 24/*Y*/, 25/*Z*/, 99, 99, 99, 99, 99, + 99, 26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/, + 33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/, + 41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/, + 49/*x*/, 50/*y*/, 51/*z*/, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 +}; + +static const char kWebSafeBase64DecodeChars[] = { + // This array was generated by the following code: + // #include + // #include + // #include + // main() + // { + // static const char Base64[] = + // "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; + // char *pos; + // int idx, i, j; + // printf(" "); + // for (i = 0; i < 255; i += 8) { + // for (j = i; j < i + 8; j++) { + // pos = strchr(Base64, j); + // if ((pos == NULL) || (j == 0)) + // idx = 99; + // else + // idx = pos - Base64; + // if (idx == 99) + // printf(" %2d, ", idx); + // else + // printf(" %2d/*%c*/,", idx, j); + // } + // printf("\n "); + // } + // } + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 62/*-*/, 99, 99, + 52/*0*/, 53/*1*/, 54/*2*/, 55/*3*/, 56/*4*/, 57/*5*/, 58/*6*/, 59/*7*/, + 60/*8*/, 61/*9*/, 99, 99, 99, 99, 99, 99, + 99, 0/*A*/, 1/*B*/, 2/*C*/, 3/*D*/, 4/*E*/, 5/*F*/, 6/*G*/, + 7/*H*/, 8/*I*/, 9/*J*/, 10/*K*/, 11/*L*/, 12/*M*/, 13/*N*/, 14/*O*/, + 15/*P*/, 16/*Q*/, 17/*R*/, 18/*S*/, 19/*T*/, 20/*U*/, 21/*V*/, 22/*W*/, + 23/*X*/, 24/*Y*/, 25/*Z*/, 99, 99, 99, 99, 63/*_*/, + 99, 26/*a*/, 27/*b*/, 28/*c*/, 29/*d*/, 30/*e*/, 31/*f*/, 32/*g*/, + 33/*h*/, 34/*i*/, 35/*j*/, 36/*k*/, 37/*l*/, 38/*m*/, 39/*n*/, 40/*o*/, + 41/*p*/, 42/*q*/, 43/*r*/, 44/*s*/, 45/*t*/, 46/*u*/, 47/*v*/, 48/*w*/, + 49/*x*/, 50/*y*/, 51/*z*/, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 +}; + + +// Tests a character to see if it's a whitespace character. +// +// Returns: +// YES if the character is a whitespace character. +// NO if the character is not a whitespace character. +// +GTM_INLINE BOOL IsSpace(unsigned char c) { + // we use our own mapping here because we don't want anything w/ locale + // support. + static BOOL kSpaces[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // 0-9 + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 10-19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20-29 + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // 30-39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40-49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50-59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60-69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70-79 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80-89 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90-99 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 100-109 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 110-119 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 120-129 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 130-139 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 140-149 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 150-159 + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 160-169 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 170-179 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 180-189 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 190-199 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 200-209 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 210-219 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 220-229 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 230-239 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 240-249 + 0, 0, 0, 0, 0, 1, // 250-255 + }; + return kSpaces[c]; +} + +// Calculate how long the data will be once it's base64 encoded. +// +// Returns: +// The guessed encoded length for a source length +// +GTM_INLINE NSUInteger CalcEncodedLength(NSUInteger srcLen, BOOL padded) { + NSUInteger intermediate_result = 8 * srcLen + 5; + NSUInteger len = intermediate_result / 6; + if (padded) { + len = ((len + 3) / 4) * 4; + } + return len; +} + +// Tries to calculate how long the data will be once it's base64 decoded. +// Unlike the above, this is always an upperbound, since the source data +// could have spaces and might end with the padding characters on them. +// +// Returns: +// The guessed decoded length for a source length +// +GTM_INLINE NSUInteger GuessDecodedLength(NSUInteger srcLen) { + return (srcLen + 3) / 4 * 3; +} + + +@interface GTMBase64 (PrivateMethods) + ++(NSData *)baseEncode:(const void *)bytes + length:(NSUInteger)length + charset:(const char *)charset + padded:(BOOL)padded; + ++(NSData *)baseDecode:(const void *)bytes + length:(NSUInteger)length + charset:(const char*)charset + requirePadding:(BOOL)requirePadding; + ++(NSUInteger)baseEncode:(const char *)srcBytes + srcLen:(NSUInteger)srcLen + destBytes:(char *)destBytes + destLen:(NSUInteger)destLen + charset:(const char *)charset + padded:(BOOL)padded; + ++(NSUInteger)baseDecode:(const char *)srcBytes + srcLen:(NSUInteger)srcLen + destBytes:(char *)destBytes + destLen:(NSUInteger)destLen + charset:(const char *)charset + requirePadding:(BOOL)requirePadding; + +@end + + +@implementation GTMBase64 + +// +// Standard Base64 (RFC) handling +// + ++(NSData *)encodeData:(NSData *)data { + return [self baseEncode:[data bytes] + length:[data length] + charset:kBase64EncodeChars + padded:YES]; +} + ++(NSData *)decodeData:(NSData *)data { + return [self baseDecode:[data bytes] + length:[data length] + charset:kBase64DecodeChars + requirePadding:YES]; +} + ++(NSData *)encodeBytes:(const void *)bytes length:(NSUInteger)length { + return [self baseEncode:bytes + length:length + charset:kBase64EncodeChars + padded:YES]; +} + ++(NSData *)decodeBytes:(const void *)bytes length:(NSUInteger)length { + return [self baseDecode:bytes + length:length + charset:kBase64DecodeChars + requirePadding:YES]; +} + ++(NSString *)stringByEncodingData:(NSData *)data { + NSString *result = nil; + NSData *converted = [self baseEncode:[data bytes] + length:[data length] + charset:kBase64EncodeChars + padded:YES]; + if (converted) { + result = [[[NSString alloc] initWithData:converted + encoding:NSASCIIStringEncoding] autorelease]; + } + return result; +} + ++(NSString *)stringByEncodingBytes:(const void *)bytes length:(NSUInteger)length { + NSString *result = nil; + NSData *converted = [self baseEncode:bytes + length:length + charset:kBase64EncodeChars + padded:YES]; + if (converted) { + result = [[[NSString alloc] initWithData:converted + encoding:NSASCIIStringEncoding] autorelease]; + } + return result; +} + ++(NSData *)decodeString:(NSString *)string { + NSData *result = nil; + NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding]; + if (data) { + result = [self baseDecode:[data bytes] + length:[data length] + charset:kBase64DecodeChars + requirePadding:YES]; + } + return result; +} + +// +// Modified Base64 encoding so the results can go onto urls. +// +// The changes are in the characters generated and also the result isn't +// padded to a multiple of 4. +// Must use the matching call to encode/decode, won't interop with the +// RFC versions. +// + ++(NSData *)webSafeEncodeData:(NSData *)data + padded:(BOOL)padded { + return [self baseEncode:[data bytes] + length:[data length] + charset:kWebSafeBase64EncodeChars + padded:padded]; +} + ++(NSData *)webSafeDecodeData:(NSData *)data { + return [self baseDecode:[data bytes] + length:[data length] + charset:kWebSafeBase64DecodeChars + requirePadding:NO]; +} + ++(NSData *)webSafeEncodeBytes:(const void *)bytes + length:(NSUInteger)length + padded:(BOOL)padded { + return [self baseEncode:bytes + length:length + charset:kWebSafeBase64EncodeChars + padded:padded]; +} + ++(NSData *)webSafeDecodeBytes:(const void *)bytes length:(NSUInteger)length { + return [self baseDecode:bytes + length:length + charset:kWebSafeBase64DecodeChars + requirePadding:NO]; +} + ++(NSString *)stringByWebSafeEncodingData:(NSData *)data + padded:(BOOL)padded { + NSString *result = nil; + NSData *converted = [self baseEncode:[data bytes] + length:[data length] + charset:kWebSafeBase64EncodeChars + padded:padded]; + if (converted) { + result = [[[NSString alloc] initWithData:converted + encoding:NSASCIIStringEncoding] autorelease]; + } + return result; +} + ++(NSString *)stringByWebSafeEncodingBytes:(const void *)bytes + length:(NSUInteger)length + padded:(BOOL)padded { + NSString *result = nil; + NSData *converted = [self baseEncode:bytes + length:length + charset:kWebSafeBase64EncodeChars + padded:padded]; + if (converted) { + result = [[[NSString alloc] initWithData:converted + encoding:NSASCIIStringEncoding] autorelease]; + } + return result; +} + ++(NSData *)webSafeDecodeString:(NSString *)string { + NSData *result = nil; + NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding]; + if (data) { + result = [self baseDecode:[data bytes] + length:[data length] + charset:kWebSafeBase64DecodeChars + requirePadding:NO]; + } + return result; +} + +@end + +@implementation GTMBase64 (PrivateMethods) + +// +// baseEncode:length:charset:padded: +// +// Does the common lifting of creating the dest NSData. it creates & sizes the +// data for the results. |charset| is the characters to use for the encoding +// of the data. |padding| controls if the encoded data should be padded to a +// multiple of 4. +// +// Returns: +// an autorelease NSData with the encoded data, nil if any error. +// ++(NSData *)baseEncode:(const void *)bytes + length:(NSUInteger)length + charset:(const char *)charset + padded:(BOOL)padded { + // how big could it be? + NSUInteger maxLength = CalcEncodedLength(length, padded); + // make space + NSMutableData *result = [NSMutableData data]; + [result setLength:maxLength]; + // do it + NSUInteger finalLength = [self baseEncode:bytes + srcLen:length + destBytes:[result mutableBytes] + destLen:[result length] + charset:charset + padded:padded]; + if (finalLength) { + _GTMDevAssert(finalLength == maxLength, @"how did we calc the length wrong?"); + } else { + // shouldn't happen, this means we ran out of space + result = nil; + } + return result; +} + +// +// baseDecode:length:charset:requirePadding: +// +// Does the common lifting of creating the dest NSData. it creates & sizes the +// data for the results. |charset| is the characters to use for the decoding +// of the data. +// +// Returns: +// an autorelease NSData with the decoded data, nil if any error. +// +// ++(NSData *)baseDecode:(const void *)bytes + length:(NSUInteger)length + charset:(const char *)charset + requirePadding:(BOOL)requirePadding { + // could try to calculate what it will end up as + NSUInteger maxLength = GuessDecodedLength(length); + // make space + NSMutableData *result = [NSMutableData data]; + [result setLength:maxLength]; + // do it + NSUInteger finalLength = [self baseDecode:bytes + srcLen:length + destBytes:[result mutableBytes] + destLen:[result length] + charset:charset + requirePadding:requirePadding]; + if (finalLength) { + if (finalLength != maxLength) { + // resize down to how big it was + [result setLength:finalLength]; + } + } else { + // either an error in the args, or we ran out of space + result = nil; + } + return result; +} + +// +// baseEncode:srcLen:destBytes:destLen:charset:padded: +// +// Encodes the buffer into the larger. returns the length of the encoded +// data, or zero for an error. +// |charset| is the characters to use for the encoding +// |padded| tells if the result should be padded to a multiple of 4. +// +// Returns: +// the length of the encoded data. zero if any error. +// ++(NSUInteger)baseEncode:(const char *)srcBytes + srcLen:(NSUInteger)srcLen + destBytes:(char *)destBytes + destLen:(NSUInteger)destLen + charset:(const char *)charset + padded:(BOOL)padded { + if (!srcLen || !destLen || !srcBytes || !destBytes) { + return 0; + } + + char *curDest = destBytes; + const unsigned char *curSrc = (const unsigned char *)(srcBytes); + + // Three bytes of data encodes to four characters of cyphertext. + // So we can pump through three-byte chunks atomically. + while (srcLen > 2) { + // space? + _GTMDevAssert(destLen >= 4, @"our calc for encoded length was wrong"); + curDest[0] = charset[curSrc[0] >> 2]; + curDest[1] = charset[((curSrc[0] & 0x03) << 4) + (curSrc[1] >> 4)]; + curDest[2] = charset[((curSrc[1] & 0x0f) << 2) + (curSrc[2] >> 6)]; + curDest[3] = charset[curSrc[2] & 0x3f]; + + curDest += 4; + curSrc += 3; + srcLen -= 3; + destLen -= 4; + } + + // now deal with the tail (<=2 bytes) + switch (srcLen) { + case 0: + // Nothing left; nothing more to do. + break; + case 1: + // One byte left: this encodes to two characters, and (optionally) + // two pad characters to round out the four-character cypherblock. + _GTMDevAssert(destLen >= 2, @"our calc for encoded length was wrong"); + curDest[0] = charset[curSrc[0] >> 2]; + curDest[1] = charset[(curSrc[0] & 0x03) << 4]; + curDest += 2; + destLen -= 2; + if (padded) { + _GTMDevAssert(destLen >= 2, @"our calc for encoded length was wrong"); + curDest[0] = kBase64PaddingChar; + curDest[1] = kBase64PaddingChar; + curDest += 2; + } + break; + case 2: + // Two bytes left: this encodes to three characters, and (optionally) + // one pad character to round out the four-character cypherblock. + _GTMDevAssert(destLen >= 3, @"our calc for encoded length was wrong"); + curDest[0] = charset[curSrc[0] >> 2]; + curDest[1] = charset[((curSrc[0] & 0x03) << 4) + (curSrc[1] >> 4)]; + curDest[2] = charset[(curSrc[1] & 0x0f) << 2]; + curDest += 3; + destLen -= 3; + if (padded) { + _GTMDevAssert(destLen >= 1, @"our calc for encoded length was wrong"); + curDest[0] = kBase64PaddingChar; + curDest += 1; + } + break; + } + // return the length + return (curDest - destBytes); +} + +// +// baseDecode:srcLen:destBytes:destLen:charset:requirePadding: +// +// Decodes the buffer into the larger. returns the length of the decoded +// data, or zero for an error. +// |charset| is the character decoding buffer to use +// +// Returns: +// the length of the encoded data. zero if any error. +// ++(NSUInteger)baseDecode:(const char *)srcBytes + srcLen:(NSUInteger)srcLen + destBytes:(char *)destBytes + destLen:(NSUInteger)destLen + charset:(const char *)charset + requirePadding:(BOOL)requirePadding { + if (!srcLen || !destLen || !srcBytes || !destBytes) { + return 0; + } + + int decode; + NSUInteger destIndex = 0; + int state = 0; + char ch = 0; + while (srcLen-- && (ch = *srcBytes++) != 0) { + if (IsSpace(ch)) // Skip whitespace + continue; + + if (ch == kBase64PaddingChar) + break; + + decode = charset[(unsigned int)ch]; + if (decode == kBase64InvalidChar) + return 0; + + // Four cyphertext characters decode to three bytes. + // Therefore we can be in one of four states. + switch (state) { + case 0: + // We're at the beginning of a four-character cyphertext block. + // This sets the high six bits of the first byte of the + // plaintext block. + _GTMDevAssert(destIndex < destLen, @"our calc for decoded length was wrong"); + destBytes[destIndex] = decode << 2; + state = 1; + break; + case 1: + // We're one character into a four-character cyphertext block. + // This sets the low two bits of the first plaintext byte, + // and the high four bits of the second plaintext byte. + _GTMDevAssert((destIndex+1) < destLen, @"our calc for decoded length was wrong"); + destBytes[destIndex] |= decode >> 4; + destBytes[destIndex+1] = (decode & 0x0f) << 4; + destIndex++; + state = 2; + break; + case 2: + // We're two characters into a four-character cyphertext block. + // This sets the low four bits of the second plaintext + // byte, and the high two bits of the third plaintext byte. + // However, if this is the end of data, and those two + // bits are zero, it could be that those two bits are + // leftovers from the encoding of data that had a length + // of two mod three. + _GTMDevAssert((destIndex+1) < destLen, @"our calc for decoded length was wrong"); + destBytes[destIndex] |= decode >> 2; + destBytes[destIndex+1] = (decode & 0x03) << 6; + destIndex++; + state = 3; + break; + case 3: + // We're at the last character of a four-character cyphertext block. + // This sets the low six bits of the third plaintext byte. + _GTMDevAssert(destIndex < destLen, @"our calc for decoded length was wrong"); + destBytes[destIndex] |= decode; + destIndex++; + state = 0; + break; + } + } + + // We are done decoding Base-64 chars. Let's see if we ended + // on a byte boundary, and/or with erroneous trailing characters. + if (ch == kBase64PaddingChar) { // We got a pad char + if ((state == 0) || (state == 1)) { + return 0; // Invalid '=' in first or second position + } + if (srcLen == 0) { + if (state == 2) { // We run out of input but we still need another '=' + return 0; + } + // Otherwise, we are in state 3 and only need this '=' + } else { + if (state == 2) { // need another '=' + while ((ch = *srcBytes++) && (srcLen-- > 0)) { + if (!IsSpace(ch)) + break; + } + if (ch != kBase64PaddingChar) { + return 0; + } + } + // state = 1 or 2, check if all remain padding is space + while ((ch = *srcBytes++) && (srcLen-- > 0)) { + if (!IsSpace(ch)) { + return 0; + } + } + } + } else { + // We ended by seeing the end of the string. + + if (requirePadding) { + // If we require padding, then anything but state 0 is an error. + if (state != 0) { + return 0; + } + } else { + // Make sure we have no partial bytes lying around. Note that we do not + // require trailing '=', so states 2 and 3 are okay too. + if (state == 1) { + return 0; + } + } + } + + // If then next piece of output was valid and got written to it means we got a + // very carefully crafted input that appeared valid but contains some trailing + // bits past the real length, so just toss the thing. + if ((destIndex < destLen) && + (destBytes[destIndex] != 0)) { + return 0; + } + + return destIndex; +} + +@end diff --git a/CocoaSecurity/GTMBase64/CocoaSecurity-GTMDefines.h b/CocoaSecurity/GTMBase64/CocoaSecurity-GTMDefines.h new file mode 100644 index 0000000..b491b41 --- /dev/null +++ b/CocoaSecurity/GTMBase64/CocoaSecurity-GTMDefines.h @@ -0,0 +1,253 @@ +// +// GTMDefines.h +// +// Copyright 2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. +// + +// ============================================================================ + +#include +#include + +// Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs +#ifndef MAC_OS_X_VERSION_10_5 +#define MAC_OS_X_VERSION_10_5 1050 +#endif +#ifndef MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_10_6 1060 +#endif + +// ---------------------------------------------------------------------------- +// CPP symbols that can be overridden in a prefix to control how the toolbox +// is compiled. +// ---------------------------------------------------------------------------- + + +// By setting the GTM_CONTAINERS_VALIDATION_FAILED_LOG and +// GTM_CONTAINERS_VALIDATION_FAILED_ASSERT macros you can control what happens +// when a validation fails. If you implement your own validators, you may want +// to control their internals using the same macros for consistency. +#ifndef GTM_CONTAINERS_VALIDATION_FAILED_ASSERT +#define GTM_CONTAINERS_VALIDATION_FAILED_ASSERT 0 +#endif + +// Give ourselves a consistent way to do inlines. Apple's macros even use +// a few different actual definitions, so we're based off of the foundation +// one. +#if !defined(GTM_INLINE) +#if defined (__GNUC__) && (__GNUC__ == 4) +#define GTM_INLINE static __inline__ __attribute__((always_inline)) +#else +#define GTM_INLINE static __inline__ +#endif +#endif + +// Give ourselves a consistent way of doing externs that links up nicely +// when mixing objc and objc++ +#if !defined (GTM_EXTERN) +#if defined __cplusplus +#define GTM_EXTERN extern "C" +#else +#define GTM_EXTERN extern +#endif +#endif + +// Give ourselves a consistent way of exporting things if we have visibility +// set to hidden. +#if !defined (GTM_EXPORT) +#define GTM_EXPORT __attribute__((visibility("default"))) +#endif + +// _GTMDevLog & _GTMDevAssert +// +// _GTMDevLog & _GTMDevAssert are meant to be a very lightweight shell for +// developer level errors. This implementation simply macros to NSLog/NSAssert. +// It is not intended to be a general logging/reporting system. +// +// Please see http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert +// for a little more background on the usage of these macros. +// +// _GTMDevLog log some error/problem in debug builds +// _GTMDevAssert assert if conditon isn't met w/in a method/function +// in all builds. +// +// To replace this system, just provide different macro definitions in your +// prefix header. Remember, any implementation you provide *must* be thread +// safe since this could be called by anything in what ever situtation it has +// been placed in. +// + +// We only define the simple macros if nothing else has defined this. +#ifndef _GTMDevLog + +#ifdef DEBUG +#define _GTMDevLog(...) NSLog(__VA_ARGS__) +#else +#define _GTMDevLog(...) do { } while (0) +#endif + +#endif // _GTMDevLog + +// Declared here so that it can easily be used for logging tracking if +// necessary. See GTMUnitTestDevLog.h for details. +@class NSString; +GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...); + +#ifndef _GTMDevAssert +// we directly invoke the NSAssert handler so we can pass on the varargs +// (NSAssert doesn't have a macro we can use that takes varargs) +#if !defined(NS_BLOCK_ASSERTIONS) +#define _GTMDevAssert(condition, ...) \ +do { \ +if (!(condition)) { \ +[[NSAssertionHandler currentHandler] \ +handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ +file:[NSString stringWithUTF8String:__FILE__] \ +lineNumber:__LINE__ \ +description:__VA_ARGS__]; \ +} \ +} while(0) +#else // !defined(NS_BLOCK_ASSERTIONS) +#define _GTMDevAssert(condition, ...) do { } while (0) +#endif // !defined(NS_BLOCK_ASSERTIONS) + +#endif // _GTMDevAssert + +// _GTMCompileAssert +// _GTMCompileAssert is an assert that is meant to fire at compile time if you +// want to check things at compile instead of runtime. For example if you +// want to check that a wchar is 4 bytes instead of 2 you would use +// _GTMCompileAssert(sizeof(wchar_t) == 4, wchar_t_is_4_bytes_on_OS_X) +// Note that the second "arg" is not in quotes, and must be a valid processor +// symbol in it's own right (no spaces, punctuation etc). + +// Wrapping this in an #ifndef allows external groups to define their own +// compile time assert scheme. +#ifndef _GTMCompileAssert +// We got this technique from here: +// http://unixjunkie.blogspot.com/2007/10/better-compile-time-asserts_29.html + +#define _GTMCompileAssertSymbolInner(line, msg) _GTMCOMPILEASSERT ## line ## __ ## msg +#define _GTMCompileAssertSymbol(line, msg) _GTMCompileAssertSymbolInner(line, msg) +#define _GTMCompileAssert(test, msg) \ +typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ] +#endif // _GTMCompileAssert + +// Macro to allow fast enumeration when building for 10.5 or later, and +// reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration +// does keys, so pick the right thing, nothing is done on the FastEnumeration +// side to be sure you're getting what you wanted. +#ifndef GTM_FOREACH_OBJECT +#if TARGET_OS_IPHONE || !(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) +#define GTM_FOREACH_ENUMEREE(element, enumeration) \ +for (element in enumeration) +#define GTM_FOREACH_OBJECT(element, collection) \ +for (element in collection) +#define GTM_FOREACH_KEY(element, collection) \ +for (element in collection) +#else +#define GTM_FOREACH_ENUMEREE(element, enumeration) \ +for (NSEnumerator *_ ## element ## _enum = enumeration; \ +(element = [_ ## element ## _enum nextObject]) != nil; ) +#define GTM_FOREACH_OBJECT(element, collection) \ +GTM_FOREACH_ENUMEREE(element, [collection objectEnumerator]) +#define GTM_FOREACH_KEY(element, collection) \ +GTM_FOREACH_ENUMEREE(element, [collection keyEnumerator]) +#endif +#endif + +// ============================================================================ + +// ---------------------------------------------------------------------------- +// CPP symbols defined based on the project settings so the GTM code has +// simple things to test against w/o scattering the knowledge of project +// setting through all the code. +// ---------------------------------------------------------------------------- + +// Provide a single constant CPP symbol that all of GTM uses for ifdefing +// iPhone code. +#if TARGET_OS_IPHONE // iPhone SDK +// For iPhone specific stuff +#define GTM_IPHONE_SDK 1 +#if TARGET_IPHONE_SIMULATOR +#define GTM_IPHONE_SIMULATOR 1 +#else +#define GTM_IPHONE_DEVICE 1 +#endif // TARGET_IPHONE_SIMULATOR +#else +// For MacOS specific stuff +#define GTM_MACOS_SDK 1 +#endif + +// Some of our own availability macros +#if GTM_MACOS_SDK +#define GTM_AVAILABLE_ONLY_ON_IPHONE UNAVAILABLE_ATTRIBUTE +#define GTM_AVAILABLE_ONLY_ON_MACOS +#else +#define GTM_AVAILABLE_ONLY_ON_IPHONE +#define GTM_AVAILABLE_ONLY_ON_MACOS UNAVAILABLE_ATTRIBUTE +#endif + +// Provide a symbol to include/exclude extra code for GC support. (This mainly +// just controls the inclusion of finalize methods). +#ifndef GTM_SUPPORT_GC +#if GTM_IPHONE_SDK +// iPhone never needs GC +#define GTM_SUPPORT_GC 0 +#else +// We can't find a symbol to tell if GC is supported/required, so best we +// do on Mac targets is include it if we're on 10.5 or later. +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#define GTM_SUPPORT_GC 0 +#else +#define GTM_SUPPORT_GC 1 +#endif +#endif +#endif + +// To simplify support for 64bit (and Leopard in general), we provide the type +// defines for non Leopard SDKs +#if !(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) +// NSInteger/NSUInteger and Max/Mins +#ifndef NSINTEGER_DEFINED +#if __LP64__ || NS_BUILD_32_LIKE_64 +typedef long NSInteger; +typedef unsigned long NSUInteger; +#else +typedef int NSInteger; +typedef unsigned int NSUInteger; +#endif +#define NSIntegerMax LONG_MAX +#define NSIntegerMin LONG_MIN +#define NSUIntegerMax ULONG_MAX +#define NSINTEGER_DEFINED 1 +#endif // NSINTEGER_DEFINED +// CGFloat +#ifndef CGFLOAT_DEFINED +#if defined(__LP64__) && __LP64__ +// This really is an untested path (64bit on Tiger?) +typedef double CGFloat; +#define CGFLOAT_MIN DBL_MIN +#define CGFLOAT_MAX DBL_MAX +#define CGFLOAT_IS_DOUBLE 1 +#else /* !defined(__LP64__) || !__LP64__ */ +typedef float CGFloat; +#define CGFLOAT_MIN FLT_MIN +#define CGFLOAT_MAX FLT_MAX +#define CGFLOAT_IS_DOUBLE 0 +#endif /* !defined(__LP64__) || !__LP64__ */ +#define CGFLOAT_DEFINED 1 +#endif // CGFLOAT_DEFINED +#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 diff --git a/CocoaSecurityTests/.DS_Store b/CocoaSecurityTests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..24fb012e44dcab99ad0960594addd7998c40cc61 GIT binary patch literal 6148 zcmeHKyG{c^3>-s>lW0;>?hk-OPqB(FUyvU_N)QrCxCoK{Ix4=5I{(A?0ZOz-OMz_3 zo?EYHS2xA^3_uo#%^ffY(9sp~uAw#ES8wbhGKykn?D2{L&)eZ?)l^R>l-uDEFSx}P zC;auW+Xv-ls%AIz{pRqt20o7;_tS@GHWf$(Qh`(;6-Wgd1=zFIx+}+wsX!`_3j8Rb z--kk1tbwDWeL5Iy1R&0sHsiC+62zhjVhtP}nW2eOiB6RmF~sT2m#C|OqodOyb~De3 zn8&;9P-AU(U7vFX_L`|L3G!r2?tIzfwSE{ih> u&>!gE##$?9uvSd8R?LOA;_H*TqR-r~fup0*nKwEye*{#Qv{c|P6!-$41RZYx literal 0 HcmV?d00001 diff --git a/CocoaSecurityTests/CocoaSecurityTests-Info.plist b/CocoaSecurityTests/CocoaSecurityTests-Info.plist new file mode 100644 index 0000000..f18eb29 --- /dev/null +++ b/CocoaSecurityTests/CocoaSecurityTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.Phate.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/CocoaSecurityTests/CocoaSecurityTests.h b/CocoaSecurityTests/CocoaSecurityTests.h new file mode 100644 index 0000000..00fd3dc --- /dev/null +++ b/CocoaSecurityTests/CocoaSecurityTests.h @@ -0,0 +1,14 @@ +// +// CocoaSecurityTests.h +// CocoaSecurityTests +// +// Created by Kelp on 12/5/13. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import +#import "CocoaSecurity.h" + +@interface CocoaSecurityTests : SenTestCase + +@end diff --git a/CocoaSecurityTests/CocoaSecurityTests.m b/CocoaSecurityTests/CocoaSecurityTests.m new file mode 100644 index 0000000..a905ff1 --- /dev/null +++ b/CocoaSecurityTests/CocoaSecurityTests.m @@ -0,0 +1,134 @@ +// +// CocoaSecurityTests.m +// CocoaSecurityTests +// +// Created by Kelp on 12/5/13. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import "CocoaSecurityTests.h" + +@implementation CocoaSecurityTests + +- (void)setUp +{ + [super setUp]; + + // Set-up code here. +} + +- (void)tearDown +{ + // Tear-down code here. + + [super tearDown]; +} + +- (void)testEncodeDecode +{ + CocoaSecurityDecoder *decoder = [[[CocoaSecurityDecoder alloc] init] autorelease]; + CocoaSecurityEncoder *encoder = [[[CocoaSecurityEncoder alloc] init] autorelease]; + + // HEX + STAssertEqualObjects([encoder hex:[decoder hex:@"CC0A69779E15780ADAE46C45EB451A23"] useLower:false], + @"CC0A69779E15780ADAE46C45EB451A23", nil); + + // Base64 + STAssertEqualObjects([encoder base64:[decoder base64:@"zT1PS64MnXIUDCUiy13RRg=="]], @"zT1PS64MnXIUDCUiy13RRg==", nil); +} + +- (void)testAES +{ + CocoaSecurity *cs = [[[CocoaSecurity alloc] init] autorelease]; + CocoaSecurityDecoder *decoder = [[[CocoaSecurityDecoder alloc] init] autorelease]; + + // AES128 + CocoaSecurityResult *aes128 = [cs aesEncryptWithData:[@"kelp" dataUsingEncoding:NSUTF8StringEncoding] + key:[decoder hex:@"C40C69779E15780ADAE46C45EB451E23"] + iv:[decoder hex:@"CC0A69779E15780ADAE46C45EB451A23"]]; + STAssertEqualObjects(aes128.base64, @"zT1PS64MnXIUDCUiy13RRg==", nil); + STAssertEqualObjects([cs aesDecryptWithBase64:aes128.base64 + hexKey:@"C40C69779E15780ADAE46C45EB451E23" + hexIv:@"CC0A69779E15780ADAE46C45EB451A23"].utf8String, @"kelp", nil); + + + // AES192 + CocoaSecurityResult *aes192 = [cs aesEncryptWithData:[@"kelp" dataUsingEncoding:NSUTF8StringEncoding] + key:[decoder hex:@"C40C69779E15780ADAE46C45EB451E230000000000000000"] + iv:[decoder hex:@"CC0A69779E15780ADAE46C45EB451A23"]]; + STAssertEqualObjects(aes192.base64, @"zSpp/l/B/Gp+j0vByqcTVg==", nil); + STAssertEqualObjects([cs aesDecryptWithBase64:aes192.base64 + hexKey:@"C40C69779E15780ADAE46C45EB451E230000000000000000" + hexIv:@"CC0A69779E15780ADAE46C45EB451A23"].utf8String, @"kelp", nil); + + // AES256 + CocoaSecurityResult *aes256 = [cs aesEncrypt:@"kelp" + hexKey:@"280f8bb8c43d532f389ef0e2a5321220b0782b065205dcdfcb8d8f02ed5115b9" + hexIv:@"CC0A69779E15780ADAE46C45EB451A23"]; + STAssertEqualObjects(aes256.base64, @"WQYg5qvcGyCBY3IF0hPsoQ==", nil); + STAssertEqualObjects([cs aesDecryptWithBase64:aes256.base64 + hexKey:@"280f8bb8c43d532f389ef0e2a5321220b0782b065205dcdfcb8d8f02ed5115b9" + hexIv:@"CC0A69779E15780ADAE46C45EB451A23"].utf8String, @"kelp", nil); + + + CocoaSecurityResult *aesDefault = [cs aesEncrypt:@"kelp" key:@"key"]; + STAssertEqualObjects(aesDefault.base64, @"ez9uubPneV1d2+rpjnabJw==", nil); + STAssertEqualObjects([cs aesDecryptWithBase64:aesDefault.base64 key:@"key"].utf8String, @"kelp", nil); +} + +- (void)testMD5 +{ + CocoaSecurity *cs = [[[CocoaSecurity alloc] init] autorelease]; + CocoaSecurityResult *md5Result = [cs md5:@"kelp"]; + CocoaSecurityResult *hmacMd5Result = [cs hmacMd5:@"kelp" hmacKey:@"key"]; + + STAssertEqualObjects(md5Result.hex, @"C40C69779E15780ADAE46C45EB451E23", nil); + STAssertEqualObjects(md5Result.hexLower, @"c40c69779e15780adae46c45eb451e23", nil); + STAssertEqualObjects(md5Result.base64, @"xAxpd54VeAra5GxF60UeIw==", nil); + + STAssertEqualObjects(hmacMd5Result.hex, @"2DFF352719234D5D6A9839FD8F43C8D2", nil); + STAssertEqualObjects(hmacMd5Result.hexLower, @"2dff352719234d5d6a9839fd8f43c8d2", nil); + STAssertEqualObjects(hmacMd5Result.base64, @"Lf81JxkjTV1qmDn9j0PI0g==", nil); +} + +- (void)testSHA +{ + CocoaSecurity *cs = [[[CocoaSecurity alloc] init] autorelease]; + CocoaSecurityResult *sha1Result = [cs sha1:@"kelp"]; + CocoaSecurityResult *sha224Result = [cs sha224:@"kelp"]; + CocoaSecurityResult *sha256Result = [cs sha256:@"kelp"]; + CocoaSecurityResult *sha384Result = [cs sha384:@"kelp"]; + CocoaSecurityResult *sha512Result = [cs sha512:@"kelp"]; + CocoaSecurityResult *hmacSha1Result = [cs hmacSha1:@"kelp" hmacKey:@"key"]; + CocoaSecurityResult *hmacSha224Result = [cs hmacSha224:@"kelp" hmacKey:@"key"]; + CocoaSecurityResult *hmacSha256Result = [cs hmacSha256:@"kelp" hmacKey:@"key"]; + CocoaSecurityResult *hmacSha384Result = [cs hmacSha384:@"kelp" hmacKey:@"key"]; + CocoaSecurityResult *hmacSha512Result = [cs hmacSha512:@"kelp" hmacKey:@"key"]; + + STAssertEqualObjects(sha1Result.hexLower, @"70b6a0495fb444a63297c83de187b1730a18e85a", nil); + STAssertEqualObjects(sha1Result.base64, @"cLagSV+0RKYyl8g94YexcwoY6Fo=", nil); + STAssertEqualObjects(hmacSha1Result.hexLower, @"fae888da051e44eb0c57f43935ad82cdbedf482f", nil); + STAssertEqualObjects(hmacSha1Result.base64, @"+uiI2gUeROsMV/Q5Na2Czb7fSC8=", nil); + + STAssertEqualObjects(sha224Result.hexLower, @"1e124576cebf14ecdac30b8ca05ff94deb343f54ebb0eab21559dcf1", nil); + STAssertEqualObjects(sha224Result.base64, @"HhJFds6/FOzawwuMoF/5Tes0P1TrsOqyFVnc8Q==", nil); + STAssertEqualObjects(hmacSha224Result.hexLower, @"4777556ee573705fcf6194de22947e09562653a84684c4b015a91e0c", nil); + STAssertEqualObjects(hmacSha224Result.base64, @"R3dVbuVzcF/PYZTeIpR+CVYmU6hGhMSwFakeDA==", nil); + + STAssertEqualObjects(sha256Result.hexLower, @"280f8bb8c43d532f389ef0e2a5321220b0782b065205dcdfcb8d8f02ed5115b9", nil); + STAssertEqualObjects(sha256Result.base64, @"KA+LuMQ9Uy84nvDipTISILB4KwZSBdzfy42PAu1RFbk=", nil); + STAssertEqualObjects(hmacSha256Result.hexLower, @"09e6c01ee44e4fc87871d3d8eb5265b67a941e9bf68d1b33851aeeed0114cd33", nil); + STAssertEqualObjects(hmacSha256Result.base64, @"CebAHuROT8h4cdPY61JltnqUHpv2jRszhRru7QEUzTM=", nil); + + STAssertEqualObjects(sha384Result.hexLower, @"e0801e06e6eea6257018bc0f2aaf1f7ec23385ce2ac9865fe209322262f323e80c81f65e711e30d162af5638ef8b4334", nil); + STAssertEqualObjects(sha384Result.base64, @"4IAeBubupiVwGLwPKq8ffsIzhc4qyYZf4gkyImLzI+gMgfZecR4w0WKvVjjvi0M0", nil); + STAssertEqualObjects(hmacSha384Result.hexLower, @"99f2a12918f5e0c7e21ef4759ecb8dd882c95af32a204ac83928aa413e1d8e9ed312c29c41e2f3c00a78d448df11d15e", nil); + STAssertEqualObjects(hmacSha384Result.base64, @"mfKhKRj14MfiHvR1nsuN2ILJWvMqIErIOSiqQT4djp7TEsKcQeLzwAp41EjfEdFe", nil); + + STAssertEqualObjects(sha512Result.hexLower, @"af8489a9fb6dcb8973515cdda3366c939ebcc8ac8fb0a7c322f1333babe03655222930ad48b4924f1a1f13c23856bc3c2e1b93cb10c74e72362e5457756517ff", nil); + STAssertEqualObjects(sha512Result.base64, @"r4SJqftty4lzUVzdozZsk568yKyPsKfDIvEzO6vgNlUiKTCtSLSSTxofE8I4Vrw8LhuTyxDHTnI2LlRXdWUX/w==", nil); + STAssertEqualObjects(hmacSha512Result.hexLower, @"3807619fdaa2dd77e3dd554a627284406000a5c924db72202af0e6b1832789a94bacc710dc2b7da61fbfd6e1065dfe39085a872538f5b19fde112092c90d893a", nil); + STAssertEqualObjects(hmacSha512Result.base64, @"OAdhn9qi3Xfj3VVKYnKEQGAApckk23IgKvDmsYMnialLrMcQ3Ct9ph+/1uEGXf45CFqHJTj1sZ/eESCSyQ2JOg==", nil); +} + +@end diff --git a/CocoaSecurityTests/en.lproj/InfoPlist.strings b/CocoaSecurityTests/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/CocoaSecurityTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/iOS View/.DS_Store b/iOS View/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7ec204ee37bc905d74d7e7bd2400d298ea6e85d1 GIT binary patch literal 6148 zcmeHKJxc>Y5PhRT4s23d?k^CmZI*EUf`GMG_W!U6Mp5jH9rhUTycwRBP4#p_xg8$yf@^GW z#9s~Dol`FEr)suC->(m^E8yev{dW5B%%%dVKq`<5qynixqX2uhT6gJ~F%?J!Qh^@@ z^!rfgiZyU_v`+_vjR3?M(`J0OS%O$JL9BtJBQrE{D$%JDBZfGg`4V+CaCCG!#BSy} zakIpPB6d6T#mXVoF=Hx_3Y;o%?#sFM|2z6G^ZzL+SE)cM@UIk*S-OB`p>B3kALa(5@Yw literal 0 HcmV?d00001 diff --git a/iOS View/CocoaSecurity-Info.plist b/iOS View/CocoaSecurity-Info.plist new file mode 100644 index 0000000..226a516 --- /dev/null +++ b/iOS View/CocoaSecurity-Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.Phate.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIMainStoryboardFile + MainStoryboard + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/iOS View/CocoaSecurity-Prefix.pch b/iOS View/CocoaSecurity-Prefix.pch new file mode 100644 index 0000000..d789fdd --- /dev/null +++ b/iOS View/CocoaSecurity-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'CocoaSecurity' target in the 'CocoaSecurity' project +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/iOS View/CocoaSecurityAppDelegate.h b/iOS View/CocoaSecurityAppDelegate.h new file mode 100644 index 0000000..60dbb68 --- /dev/null +++ b/iOS View/CocoaSecurityAppDelegate.h @@ -0,0 +1,15 @@ +// +// CocoaSecurityAppDelegate.h +// CocoaSecurity +// +// Created by Kelp on 12/5/14. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import + +@interface CocoaSecurityAppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/iOS View/CocoaSecurityAppDelegate.m b/iOS View/CocoaSecurityAppDelegate.m new file mode 100644 index 0000000..46b1ed2 --- /dev/null +++ b/iOS View/CocoaSecurityAppDelegate.m @@ -0,0 +1,54 @@ +// +// CocoaSecurityAppDelegate.m +// CocoaSecurity +// +// Created by Kelp on 12/5/14. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import "CocoaSecurityAppDelegate.h" + +@implementation CocoaSecurityAppDelegate + +@synthesize window = _window; + +- (void)dealloc +{ + [_window release]; + [super dealloc]; +} + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/iOS View/CocoaSecurityViewController.h b/iOS View/CocoaSecurityViewController.h new file mode 100644 index 0000000..6c74116 --- /dev/null +++ b/iOS View/CocoaSecurityViewController.h @@ -0,0 +1,13 @@ +// +// CocoaSecurityViewController.h +// CocoaSecurity +// +// Created by Kelp on 12/5/14. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import + +@interface CocoaSecurityViewController : UIViewController + +@end diff --git a/iOS View/CocoaSecurityViewController.m b/iOS View/CocoaSecurityViewController.m new file mode 100644 index 0000000..e1d4eb5 --- /dev/null +++ b/iOS View/CocoaSecurityViewController.m @@ -0,0 +1,34 @@ +// +// CocoaSecurityViewController.m +// CocoaSecurity +// +// Created by Kelp on 12/5/14. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import "CocoaSecurityViewController.h" + +@interface CocoaSecurityViewController () + +@end + +@implementation CocoaSecurityViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); +} + +@end diff --git a/iOS View/en.lproj/InfoPlist.strings b/iOS View/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/iOS View/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/iOS View/en.lproj/MainStoryboard.storyboard b/iOS View/en.lproj/MainStoryboard.storyboard new file mode 100644 index 0000000..16c175b --- /dev/null +++ b/iOS View/en.lproj/MainStoryboard.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iOS View/main.m b/iOS View/main.m new file mode 100644 index 0000000..c0e50fe --- /dev/null +++ b/iOS View/main.m @@ -0,0 +1,18 @@ +// +// main.m +// CocoaSecurity +// +// Created by Kelp on 12/5/14. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import + +#import "CocoaSecurityAppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([CocoaSecurityAppDelegate class])); + } +}