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