MYPrivateKey.h
changeset 5 b2e360b78189
parent 3 1dfe820d7ebe
child 8 4c0eafa7b233
     1.1 --- a/MYPrivateKey.h	Wed Apr 08 16:30:52 2009 -0700
     1.2 +++ b/MYPrivateKey.h	Thu Apr 09 22:27:51 2009 -0700
     1.3 @@ -7,7 +7,7 @@
     1.4  //
     1.5  
     1.6  #import "MYKey.h"
     1.7 -@class MYPublicKey, MYSHA1Digest;
     1.8 +@class MYPublicKey, MYSHA1Digest, MYIdentity;
     1.9  
    1.10  
    1.11  /** A private key, used for signing and decrypting data.
    1.12 @@ -48,6 +48,12 @@
    1.13  //@{
    1.14  #if !TARGET_OS_IPHONE
    1.15  
    1.16 +/** Creates a self-signed identity certificate using this key-pair.
    1.17 +    The attributes describe the certificate's metadata, including its expiration date and the
    1.18 +    subject's name. Keys for the dictionary are given below; the only mandatory one is
    1.19 +    kMYIdentityCommonNameKey. */
    1.20 +- (MYIdentity*) createSelfSignedIdentityWithAttributes: (NSDictionary*)attributes;
    1.21 +
    1.22  /** Exports the private key as a data blob, so that it can be stored as a backup, or transferred
    1.23      to another computer. Since the key is sensitive, it must be exported in encrypted form
    1.24      using a user-chosen passphrase. This method will display a standard alert panel, run by
    1.25 @@ -75,3 +81,14 @@
    1.26  //@}
    1.27  
    1.28  @end
    1.29 +
    1.30 +
    1.31 +/* Attribute keys for creating identities: */
    1.32 +#define kMYIdentityCommonNameKey    @"Common Name"      // NSString. Required!
    1.33 +#define kMYIdentityGivenNameKey     @"Given Name"
    1.34 +#define kMYIdentitySurnameKey       @"Surname"
    1.35 +#define kMYIdentityDescriptionKey   @"Description"
    1.36 +#define kMYIdentityEmailAddressKey  @"Email Address"
    1.37 +#define kMYIdentityValidFromKey     @"Valid From"       // NSDate. Defaults to the current date/time
    1.38 +#define kMYIdentityValidToKey       @"Valid To"         // NSDate. Defaults to one year from ValidFrom
    1.39 +#define kMYIdentitySerialNumberKey  @"Serial Number"    // NSNumber. Defaults to 1