MYPrivateKey.h
changeset 13 6fd9177eb6da
parent 8 4c0eafa7b233
child 21 2c300b15b381
     1.1 --- a/MYPrivateKey.h	Sun Apr 12 22:02:20 2009 -0700
     1.2 +++ b/MYPrivateKey.h	Sun Apr 19 00:01:41 2009 -0700
     1.3 @@ -7,14 +7,15 @@
     1.4  //
     1.5  
     1.6  #import "MYKey.h"
     1.7 -@class MYPublicKey, MYSHA1Digest, MYIdentity;
     1.8 +#import <CommonCrypto/CommonCryptor.h>
     1.9 +@class MYPublicKey, MYSHA1Digest, MYIdentity, MYSymmetricKey;
    1.10  
    1.11  
    1.12  /** A private key, used for signing and decrypting data.
    1.13      Always paired with a matching public key in a "key-pair".
    1.14      MYPublicKeys are instantiated by MYKeychain: either by generating a new key-pair, by
    1.15      looking up a key-pair by its attributes, or by importing a key-pair from data. */
    1.16 -@interface MYPrivateKey : MYKey <MYDecryption>
    1.17 +@interface MYPrivateKey : MYKey
    1.18  {
    1.19      @private
    1.20      MYPublicKey *_publicKey;
    1.21 @@ -33,7 +34,7 @@
    1.22      See the description of -[MYPublicKey encryptData:] for warnings and caveats.
    1.23      This method is usually used only to decrypt a symmetric session key, which then decrypts the
    1.24      rest of the data. */
    1.25 -- (NSData*) decryptData: (NSData*)data;
    1.26 +- (NSData*) rawDecryptData: (NSData*)data;
    1.27  
    1.28  /** Generates a signature of data.
    1.29      (What's actually signed using RSA is the SHA-256 digest of the data.)
    1.30 @@ -80,6 +81,15 @@
    1.31                        withPEM: (BOOL)withPEM
    1.32                     alertTitle: (NSString*)alertTitle
    1.33                    alertPrompt: (NSString*)prompt;
    1.34 +
    1.35 +/** Decrypts a session key that was wrapped (encrypted) using my matching public key.
    1.36 +    @param wrappedData  The wrapped/encrypted session key
    1.37 +    @param algorithm  The algorithm of the original session key
    1.38 +    @param sizeInBits  The key size (in bits) of the original session key
    1.39 +    @return  The reconstituted session key */
    1.40 +- (MYSymmetricKey*) unwrapSessionKey: (NSData*)wrappedData
    1.41 +                       withAlgorithm: (CCAlgorithm)algorithm
    1.42 +                          sizeInBits: (unsigned)sizeInBits;
    1.43  #endif
    1.44  //@}
    1.45