MYCertificate.h
author snej@snej.local
Thu Apr 09 22:46:48 2009 -0700 (2009-04-09)
changeset 6 2d7692f9b6b4
parent 1 60e4cbbb5128
child 8 4c0eafa7b233
permissions -rw-r--r--
Updated the README for the 0.1 release.
snej@0
     1
//
snej@0
     2
//  MYCertificate.h
snej@0
     3
//  MYCrypto
snej@0
     4
//
snej@0
     5
//  Created by Jens Alfke on 3/26/09.
snej@0
     6
//  Copyright 2009 Jens Alfke. All rights reserved.
snej@0
     7
//
snej@0
     8
snej@0
     9
#import "MYKeychainItem.h"
snej@0
    10
snej@0
    11
#if !TARGET_OS_IPHONE
snej@0
    12
#import <Security/cssmtype.h>
snej@0
    13
#endif
snej@0
    14
snej@0
    15
@class MYPublicKey;
snej@0
    16
snej@0
    17
snej@0
    18
/** An X.509 certificate. */
snej@0
    19
@interface MYCertificate : MYKeychainItem {
snej@1
    20
    @private
snej@0
    21
    SecCertificateRef _certificateRef;
snej@0
    22
}
snej@0
    23
snej@0
    24
/** Creates a MYCertificate object for an existing Keychain certificate reference. */
snej@0
    25
- (id) initWithCertificateRef: (SecCertificateRef)certificateRef;
snej@0
    26
snej@0
    27
/** Creates a MYCertificate object from exported key data, but does not add it to any keychain. */
snej@0
    28
- (id) initWithCertificateData: (NSData*)data;
snej@0
    29
snej@1
    30
/** The Keychain object reference for this certificate. */
snej@0
    31
@property (readonly) SecCertificateRef certificateRef;
snej@0
    32
snej@0
    33
/** The certificate's data. */
snej@0
    34
@property (readonly) NSData *certificateData;
snej@0
    35
snej@0
    36
/** The certificate's public key. */
snej@0
    37
@property (readonly) MYPublicKey *publicKey;
snej@0
    38
snej@1
    39
/** The name of the subject (owner) of the certificate. */
snej@0
    40
@property (readonly) NSString *commonName;
snej@1
    41
snej@2
    42
snej@2
    43
/** @name Mac-Only
snej@2
    44
 *  Functionality not available on iPhone. 
snej@2
    45
 */
snej@2
    46
//@{
snej@1
    47
#if !TARGET_OS_IPHONE
snej@2
    48
snej@2
    49
/** Creates a MYCertificate object from exported key data, but does not add it to any keychain. */
snej@2
    50
- (id) initWithCertificateData: (NSData*)data
snej@2
    51
                          type: (CSSM_CERT_TYPE) type
snej@2
    52
                      encoding: (CSSM_CERT_ENCODING) encoding;
snej@2
    53
snej@1
    54
/** The list (if any) of the subject's email addresses. */
snej@0
    55
@property (readonly) NSArray *emailAddresses;
snej@0
    56
snej@0
    57
/** Finds the current 'preferred' certificate for the given name string. */
snej@0
    58
+ (MYCertificate*) preferredCertificateForName: (NSString*)name;
snej@0
    59
snej@0
    60
/** Associates the receiver as the preferred certificate for the given name string. */
snej@0
    61
- (BOOL) setPreferredCertificateForName: (NSString*)name;
snej@2
    62
snej@0
    63
#endif
snej@2
    64
//@}
snej@0
    65
snej@0
    66
@end