2010-09-20 19:44:17 -05:00
|
|
|
//
|
|
|
|
// MGMKeychainItem.h
|
|
|
|
// MGMUsers
|
|
|
|
//
|
|
|
|
// Created by Mr. Gecko on 4/14/10.
|
2011-02-24 11:24:19 -06:00
|
|
|
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
|
2010-09-20 19:44:17 -05:00
|
|
|
//
|
|
|
|
|
2011-03-07 19:02:53 -06:00
|
|
|
#import <Foundation/Foundation.h>
|
2010-09-24 12:46:38 -05:00
|
|
|
#import <MGMUsers/MGMKeychain.h>
|
2010-09-20 19:44:17 -05:00
|
|
|
#import <Security/Security.h>
|
|
|
|
|
2010-09-24 12:46:38 -05:00
|
|
|
|
|
|
|
#if TARGET_OS_IPHONE
|
|
|
|
typedef enum {
|
|
|
|
kSecCreationDateItemAttr,
|
|
|
|
kSecModDateItemAttr,
|
|
|
|
kSecDescriptionItemAttr,
|
|
|
|
kSecCommentItemAttr,
|
|
|
|
kSecCreatorItemAttr,
|
|
|
|
kSecTypeItemAttr,
|
|
|
|
kSecLabelItemAttr,
|
|
|
|
kSecInvisibleItemAttr,
|
|
|
|
kSecNegativeItemAttr,
|
|
|
|
kSecAccountItemAttr,
|
|
|
|
kSecServiceItemAttr,
|
|
|
|
kSecGenericItemAttr,
|
|
|
|
kSecSecurityDomainItemAttr,
|
|
|
|
kSecServerItemAttr,
|
|
|
|
kSecAuthenticationTypeItemAttr,
|
|
|
|
kSecPortItemAttr,
|
|
|
|
kSecProtocolItemAttr,
|
|
|
|
kSecCertificateType,
|
|
|
|
kSecCertificateEncoding
|
|
|
|
} SecItemAttributes;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
kSecAuthenticationTypeNTLM,
|
|
|
|
kSecAuthenticationTypeMSN,
|
|
|
|
kSecAuthenticationTypeDPA,
|
|
|
|
kSecAuthenticationTypeRPA,
|
|
|
|
kSecAuthenticationTypeHTTPBasic,
|
|
|
|
kSecAuthenticationTypeHTTPDigest,
|
|
|
|
kSecAuthenticationTypeHTMLForm,
|
|
|
|
kSecAuthenticationTypeDefault
|
|
|
|
} SecAuthenticationType;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
kSecProtocolTypeFTP,
|
|
|
|
kSecProtocolTypeFTPAccount,
|
|
|
|
kSecProtocolTypeHTTP,
|
|
|
|
kSecProtocolTypeIRC,
|
|
|
|
kSecProtocolTypeNNTP,
|
|
|
|
kSecProtocolTypePOP3,
|
|
|
|
kSecProtocolTypeSMTP,
|
|
|
|
kSecProtocolTypeSOCKS,
|
|
|
|
kSecProtocolTypeIMAP,
|
|
|
|
kSecProtocolTypeLDAP,
|
|
|
|
kSecProtocolTypeAppleTalk,
|
|
|
|
kSecProtocolTypeAFP,
|
|
|
|
kSecProtocolTypeTelnet,
|
|
|
|
kSecProtocolTypeSSH,
|
|
|
|
kSecProtocolTypeFTPS,
|
|
|
|
kSecProtocolTypeHTTPS,
|
|
|
|
kSecProtocolTypeHTTPProxy,
|
|
|
|
kSecProtocolTypeHTTPSProxy,
|
|
|
|
kSecProtocolTypeFTPProxy,
|
|
|
|
kSecProtocolTypeSMB,
|
|
|
|
kSecProtocolTypeRTSP,
|
|
|
|
kSecProtocolTypeRTSPProxy,
|
|
|
|
kSecProtocolTypeDAAP,
|
|
|
|
kSecProtocolTypeEPPC,
|
|
|
|
kSecProtocolTypeIPP,
|
|
|
|
kSecProtocolTypeNNTPS,
|
|
|
|
kSecProtocolTypeLDAPS,
|
|
|
|
kSecProtocolTypeTelnetS,
|
|
|
|
kSecProtocolTypeIMAPS,
|
|
|
|
kSecProtocolTypeIRCS,
|
|
|
|
kSecProtocolTypePOP3S
|
|
|
|
} SecProtocolType;
|
|
|
|
|
|
|
|
|
|
|
|
// From OS X cssmtype.h
|
|
|
|
typedef enum {
|
|
|
|
CSSM_CERT_UNKNOWN = 0x00,
|
|
|
|
CSSM_CERT_X_509v1 = 0x01,
|
|
|
|
CSSM_CERT_X_509v2 = 0x02,
|
|
|
|
CSSM_CERT_X_509v3 = 0x03
|
|
|
|
} CSSM_CERT_TYPE;
|
|
|
|
typedef enum {
|
|
|
|
CSSM_CERT_ENCODING_UNKNOWN = 0x00,
|
|
|
|
CSSM_CERT_ENCODING_CUSTOM = 0x01,
|
|
|
|
CSSM_CERT_ENCODING_BER = 0x02,
|
|
|
|
CSSM_CERT_ENCODING_DER = 0x03
|
|
|
|
} CSSM_CERT_ENCODING;
|
|
|
|
#endif
|
|
|
|
|
2010-09-20 19:44:17 -05:00
|
|
|
@interface MGMKeychainItem : NSObject {
|
|
|
|
@private
|
2010-09-24 12:46:38 -05:00
|
|
|
#if TARGET_OS_IPHONE
|
|
|
|
NSMutableDictionary *keychainItem;
|
|
|
|
SecItemClass itemClass;
|
|
|
|
#else
|
2010-09-20 19:44:17 -05:00
|
|
|
SecKeychainItemRef keychainItem;
|
2010-09-24 12:46:38 -05:00
|
|
|
#endif
|
2010-09-20 19:44:17 -05:00
|
|
|
int error;
|
|
|
|
}
|
2010-09-24 12:46:38 -05:00
|
|
|
#if TARGET_OS_IPHONE
|
|
|
|
+ (id)itemWithDictionary:(NSDictionary *)theKeychainItem itemClass:(SecItemClass)theClass;
|
|
|
|
- (id)initWithDictionary:(NSDictionary *)theKeychainItem itemClass:(SecItemClass)theClass;
|
|
|
|
- (NSDictionary *)keychainItem;
|
|
|
|
#else
|
2010-09-20 19:44:17 -05:00
|
|
|
+ (id)itemWithRef:(SecKeychainItemRef)theItem;
|
|
|
|
- (id)initWithRef:(SecKeychainItemRef)theItem;
|
|
|
|
- (SecKeychainItemRef)keychainItem;
|
2010-09-24 12:46:38 -05:00
|
|
|
#endif
|
|
|
|
#if TARGET_OS_IPHONE
|
|
|
|
- (NSString *)attributeKey:(SecItemAttributes)theAttribute;
|
|
|
|
#endif
|
2010-09-20 19:44:17 -05:00
|
|
|
- (SecItemClass)kind;
|
|
|
|
- (NSString *)kindString;
|
|
|
|
- (BOOL)isInternetItem;
|
|
|
|
- (BOOL)isGenericItem;
|
2010-09-24 12:46:38 -05:00
|
|
|
#if !TARGET_OS_IPHONE
|
2010-09-20 19:44:17 -05:00
|
|
|
- (BOOL)isAppleShareItem;
|
2010-09-24 12:46:38 -05:00
|
|
|
#endif
|
2010-09-20 19:44:17 -05:00
|
|
|
- (BOOL)isCertificate;
|
|
|
|
- (int)error;
|
|
|
|
- (NSData *)data;
|
|
|
|
- (void)setData:(NSData *)theData;
|
|
|
|
- (NSString *)string;
|
|
|
|
- (void)setString:(NSString *)theString;
|
|
|
|
- (void)setData:(NSData *)theData forAttribute:(int)theAttribute;
|
|
|
|
- (void)setBool:(BOOL)theBool forAttribute:(int)theAttribute;
|
|
|
|
- (NSData *)attributeData:(int)theAttribute;
|
|
|
|
- (void)setString:(NSString *)theString forAttribute:(int)theAttribute;
|
|
|
|
- (NSString *)attributeString:(int)theAttribute;
|
2010-09-24 12:46:38 -05:00
|
|
|
- (void)setCreationDate:(NSDate *)theDate;
|
|
|
|
- (NSDate *)creationDate;
|
|
|
|
- (void)setModifiedDate:(NSDate *)theDate;
|
|
|
|
- (NSDate *)modifiedDate;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setDescription:(NSString *)theDescription;
|
|
|
|
- (NSString *)description;
|
|
|
|
- (void)setComment:(NSString *)theComment;
|
|
|
|
- (NSString *)comment;
|
|
|
|
- (void)setCreator:(NSString *)theCreator;
|
|
|
|
- (NSString *)creator;
|
|
|
|
- (void)setType:(NSString *)theType;
|
|
|
|
- (NSString *)type;
|
|
|
|
- (void)setName:(NSString *)theName;
|
|
|
|
- (NSString *)name;
|
|
|
|
- (void)setVisible:(BOOL)isVisible;
|
|
|
|
- (BOOL)isVisible;
|
|
|
|
- (void)setPasswordValid:(BOOL)isPasswordValid;
|
|
|
|
- (BOOL)isPasswordValid;
|
2010-09-24 12:46:38 -05:00
|
|
|
#if !TARGET_OS_IPHONE
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setHasCustomIcon:(BOOL)hasCustomIcon;
|
|
|
|
- (BOOL)hasCustomIcon;
|
2010-09-24 12:46:38 -05:00
|
|
|
#endif
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setAccount:(NSString *)theAccount;
|
|
|
|
- (NSString *)account;
|
|
|
|
- (void)setService:(NSString *)theService;
|
|
|
|
- (NSString *)service;
|
|
|
|
- (void)setAttribute:(NSString *)theAttribute;
|
|
|
|
- (NSString *)attribute;
|
|
|
|
- (void)setSecurityDomain:(NSString *)theSecurityDomain;
|
|
|
|
- (NSString *)securityDomain;
|
|
|
|
- (void)setServer:(NSString *)theServer;
|
|
|
|
- (NSString *)server;
|
|
|
|
- (void)setAuthenticationType:(SecAuthenticationType)theAuthenticationType;
|
|
|
|
- (SecAuthenticationType)authenticationType;
|
2010-09-24 12:46:38 -05:00
|
|
|
- (NSString *)authenticationTypeString;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setPort:(UInt16)thePort;
|
|
|
|
- (UInt16)port;
|
2010-09-24 12:46:38 -05:00
|
|
|
#if !TARGET_OS_IPHONE
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setVolume:(NSString *)theVolume;
|
|
|
|
- (NSString *)volume;
|
|
|
|
- (void)setAddress:(NSString *)theAddress;
|
|
|
|
- (NSString *)address;
|
|
|
|
- (void)setSignature:(SecAFPServerSignature *)theSignature;
|
|
|
|
- (SecAFPServerSignature *)signature;
|
2010-09-24 12:46:38 -05:00
|
|
|
#endif
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setProtocol:(SecProtocolType)theProtocol;
|
|
|
|
- (SecProtocolType)protocol;
|
|
|
|
- (NSString *)protocolString;
|
|
|
|
- (void)setCertificateType:(CSSM_CERT_TYPE)theCertificateType;
|
|
|
|
- (CSSM_CERT_TYPE)certificateType;
|
|
|
|
- (void)setCertificateEncoding:(CSSM_CERT_ENCODING)theCertificateEncoding;
|
|
|
|
- (CSSM_CERT_ENCODING)certificateEncoding;
|
2010-09-24 12:46:38 -05:00
|
|
|
#if !TARGET_OS_IPHONE
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setCRLType:(CSSM_CRL_TYPE)theCRLType;
|
|
|
|
- (CSSM_CRL_TYPE)CRLType;
|
2010-09-24 12:46:38 -05:00
|
|
|
- (NSString *)CRLTypeString;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setCRLEncoding:(CSSM_CRL_ENCODING)theCRLEncoding;
|
|
|
|
- (CSSM_CRL_ENCODING)CRLEncoding;
|
2010-09-24 12:46:38 -05:00
|
|
|
- (NSString *)CRLEncodingString;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)setAlias:(BOOL)isAlias;
|
|
|
|
- (BOOL)isAlias;
|
2010-09-24 12:46:38 -05:00
|
|
|
#endif
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)remove;
|
|
|
|
@end
|