5 // Created by Jens Alfke on 4/2/09.
6 // Copyright 2009 Jens Alfke. All rights reserved.
10 #import <CommonCrypto/CommonCryptor.h>
13 @interface MYSymmetricKey : MYKey <MYEncryption, MYDecryption>
15 /** Initializes a symmetric key from the given key data and algorithm. */
16 - (id) initWithKeyData: (NSData*)keyData
17 algorithm: (CCAlgorithm)algorithm;
19 /** Randomly generates a new symmetric key, using the given algorithm and key-size in bits.
20 The key is not added to any keychain; if you want to keep the key persistently, use
21 the method of the same name in the MYKeychain class. */
22 + (MYSymmetricKey*) generateSymmetricKeyOfSize: (unsigned)keySizeInBits
23 algorithm: (CCAlgorithm)algorithm;
25 /** The key's algorithm. */
26 @property (readonly) CCAlgorithm algorithm;
28 /** The key's size/length, in bits. */
29 @property (readonly) unsigned keySizeInBits;