Skip to content

Commit 17252c8

Browse files
committed
Added Keychain Sample
1 parent bdd70f3 commit 17252c8

10 files changed

+2002
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// KeyChainsSampeAppDelegate.h
3+
// KeyChainsSampe
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/02.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@class KeyChainsSampeViewController;
12+
13+
@interface KeyChainsSampeAppDelegate : NSObject <UIApplicationDelegate> {
14+
UIWindow *window;
15+
KeyChainsSampeViewController *viewController;
16+
}
17+
18+
@property (nonatomic, retain) IBOutlet UIWindow *window;
19+
@property (nonatomic, retain) IBOutlet KeyChainsSampeViewController *viewController;
20+
21+
@end
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
//
2+
// KeyChainsSampeAppDelegate.m
3+
// KeyChainsSampe
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/02.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import "KeyChainsSampeAppDelegate.h"
10+
#import "KeyChainsSampeViewController.h"
11+
12+
@implementation KeyChainsSampeAppDelegate
13+
14+
@synthesize window;
15+
@synthesize viewController;
16+
17+
18+
#pragma mark -
19+
#pragma mark Application lifecycle
20+
21+
- (void)listAttrStrings
22+
{
23+
NSLog(@"kSecAttrAccessible: %@", (id)kSecAttrAccessible);
24+
NSLog(@"kSecAttrCreationDate: %@", (id)kSecAttrCreationDate);
25+
NSLog(@"kSecAttrModificationDate: %@", (id)kSecAttrModificationDate);
26+
NSLog(@"kSecAttrDescription: %@", (id)kSecAttrDescription);
27+
NSLog(@"kSecAttrComment: %@", (id)kSecAttrComment);
28+
NSLog(@"kSecAttrCreator: %@", (id)kSecAttrCreator);
29+
NSLog(@"kSecAttrType: %@", (id)kSecAttrType);
30+
NSLog(@"kSecAttrLabel: %@", (id)kSecAttrLabel);
31+
NSLog(@"kSecAttrIsInvisible: %@", (id)kSecAttrIsInvisible);
32+
NSLog(@"kSecAttrIsNegative: %@", (id)kSecAttrIsNegative);
33+
NSLog(@"kSecAttrAccount: %@", (id)kSecAttrAccount);
34+
NSLog(@"kSecAttrService: %@", (id)kSecAttrService);
35+
NSLog(@"kSecAttrGeneric: %@", (id)kSecAttrGeneric);
36+
NSLog(@"kSecAttrSecurityDomain: %@", (id)kSecAttrSecurityDomain);
37+
NSLog(@"kSecAttrServer: %@", (id)kSecAttrServer);
38+
NSLog(@"kSecAttrProtocol: %@", (id)kSecAttrProtocol);
39+
NSLog(@"kSecAttrAuthenticationType: %@", (id)kSecAttrAuthenticationType);
40+
NSLog(@"kSecAttrPort: %@", (id)kSecAttrPort);
41+
NSLog(@"kSecAttrPath: %@", (id)kSecAttrPath);
42+
NSLog(@"kSecAttrSubject: %@", (id)kSecAttrSubject);
43+
NSLog(@"kSecAttrIssuer: %@", (id)kSecAttrIssuer);
44+
NSLog(@"kSecAttrSerialNumber: %@", (id)kSecAttrSerialNumber);
45+
NSLog(@"kSecAttrSubjectKeyID: %@", (id)kSecAttrSubjectKeyID);
46+
NSLog(@"kSecAttrPublicKeyHash: %@", (id)kSecAttrPublicKeyHash);
47+
NSLog(@"kSecAttrCertificateType: %@", (id)kSecAttrCertificateType);
48+
NSLog(@"kSecAttrCertificateEncoding: %@", (id)kSecAttrCertificateEncoding);
49+
NSLog(@"kSecAttrKeyClass: %@", (id)kSecAttrKeyClass);
50+
NSLog(@"kSecAttrApplicationLabel: %@", (id)kSecAttrApplicationLabel);
51+
NSLog(@"kSecAttrIsPermanent: %@", (id)kSecAttrIsPermanent);
52+
NSLog(@"kSecAttrApplicationTag: %@", (id)kSecAttrApplicationTag);
53+
NSLog(@"kSecAttrKeyType: %@", (id)kSecAttrKeyType);
54+
NSLog(@"kSecAttrKeySizeInBits: %@", (id)kSecAttrKeySizeInBits);
55+
NSLog(@"kSecAttrEffectiveKeySize: %@", (id)kSecAttrEffectiveKeySize);
56+
NSLog(@"kSecAttrCanEncrypt: %@", (id)kSecAttrCanEncrypt);
57+
NSLog(@"kSecAttrCanDecrypt: %@", (id)kSecAttrCanDecrypt);
58+
NSLog(@"kSecAttrCanDerive: %@", (id)kSecAttrCanDerive);
59+
NSLog(@"kSecAttrCanSign: %@", (id)kSecAttrCanSign);
60+
NSLog(@"kSecAttrCanVerify: %@", (id)kSecAttrCanVerify);
61+
NSLog(@"kSecAttrCanWrap: %@", (id)kSecAttrCanWrap);
62+
NSLog(@"kSecAttrCanUnwrap: %@", (id)kSecAttrCanUnwrap);
63+
NSLog(@"kSecAttrAccessGroup: %@", (id)kSecAttrAccessGroup);
64+
}
65+
66+
- (void)listSecAttrAccessible
67+
{
68+
NSLog(@"kSecAttrAccessibleAfterFirstUnlock: %@", (id)kSecAttrAccessibleAfterFirstUnlock);
69+
NSLog(@"kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly: %@", (id)kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly);
70+
NSLog(@"kSecAttrAccessibleAlways: %@", (id)kSecAttrAccessibleAlways);
71+
NSLog(@"kSecAttrAccessibleAlwaysThisDeviceOnly: %@", (id)kSecAttrAccessibleAlwaysThisDeviceOnly);
72+
NSLog(@"kSecAttrAccessibleWhenUnlocked: %@", (id)kSecAttrAccessibleWhenUnlocked);
73+
NSLog(@"kSecAttrAccessibleWhenUnlockedThisDeviceOnly: %@", (id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly);
74+
}
75+
76+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
77+
78+
// Override point for customization after application launch.
79+
80+
// Add the view controller's view to the window and display.
81+
[self.window addSubview:viewController.view];
82+
[self.window makeKeyAndVisible];
83+
84+
// [self listAttrStrings];
85+
// [self listSecAttrAccessible];
86+
return YES;
87+
}
88+
89+
90+
- (void)applicationWillResignActive:(UIApplication *)application {
91+
/*
92+
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.
93+
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.
94+
*/
95+
}
96+
97+
98+
- (void)applicationDidEnterBackground:(UIApplication *)application {
99+
/*
100+
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.
101+
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
102+
*/
103+
}
104+
105+
106+
- (void)applicationWillEnterForeground:(UIApplication *)application {
107+
/*
108+
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
109+
*/
110+
}
111+
112+
113+
- (void)applicationDidBecomeActive:(UIApplication *)application {
114+
/*
115+
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.
116+
*/
117+
}
118+
119+
120+
- (void)applicationWillTerminate:(UIApplication *)application {
121+
/*
122+
Called when the application is about to terminate.
123+
See also applicationDidEnterBackground:.
124+
*/
125+
}
126+
127+
128+
#pragma mark -
129+
#pragma mark Memory management
130+
131+
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
132+
/*
133+
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
134+
*/
135+
}
136+
137+
138+
- (void)dealloc {
139+
[viewController release];
140+
[window release];
141+
[super dealloc];
142+
}
143+
144+
145+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// KeyChainsSampeViewController.h
3+
// KeyChainsSampe
4+
//
5+
// Created by Hiroshi Hashiguchi on 11/02/02.
6+
// Copyright 2011 . All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface KeyChainsSampeViewController : UIViewController {
12+
13+
UITextField* loginId_;
14+
UITextField* password_;
15+
}
16+
@property (nonatomic, retain) IBOutlet UITextField* loginId;
17+
@property (nonatomic, retain) IBOutlet UITextField* password;
18+
19+
- (IBAction)getPassword:(id)sender;
20+
- (IBAction)update:(id)sender;
21+
- (IBAction)delete:(id)sender;
22+
- (IBAction)dump:(id)sender;
23+
- (IBAction)convert:(id)sender;
24+
25+
@end
26+

0 commit comments

Comments
 (0)