snej@0: //
snej@0: //  MYSymmetricKey.h
snej@0: //  MYCrypto
snej@0: //
snej@0: //  Created by Jens Alfke on 4/2/09.
snej@0: //  Copyright 2009 Jens Alfke. All rights reserved.
snej@0: //
snej@0: 
snej@0: #import "MYKey.h"
snej@0: #import <CommonCrypto/CommonCryptor.h>
snej@0: 
snej@0: 
snej@0: @interface MYSymmetricKey : MYKey <MYEncryption, MYDecryption>
snej@0: 
snej@1: /** Initializes a symmetric key from the given key data and algorithm. */
snej@1: - (id) initWithKeyData: (NSData*)keyData
snej@1:              algorithm: (CCAlgorithm)algorithm;
snej@1: 
snej@1: /** Randomly generates a new symmetric key, using the given algorithm and key-size in bits.
snej@1:     The key is not added to any keychain; if you want to keep the key persistently, use
snej@1:     the method of the same name in the MYKeychain class. */
snej@0: + (MYSymmetricKey*) generateSymmetricKeyOfSize: (unsigned)keySizeInBits
snej@0:                                      algorithm: (CCAlgorithm)algorithm;
snej@0: 
snej@1: /** The key's algorithm. */
snej@0: @property (readonly) CCAlgorithm algorithm;
snej@0: 
snej@2: /** The key's size/length, in bits. */
snej@2: @property (readonly) unsigned keySizeInBits;
snej@2: 
snej@0: @end