1 /* Copyright (c) 1998,2011,2014 Apple Inc. All Rights Reserved.
3 * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
4 * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
5 * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE, INC. AND THE
6 * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE,
7 * INC. ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
8 * EXPOSE YOU TO LIABILITY.
9 ***************************************************************************
15 * 27 Feb 1997 at Apple
16 * Broke out from NSCryptors.h.
19 #import <CryptKit/NSCryptors.h>
21 @interface NSFEEPublicKey
: NSObject
22 <NSPublicKey
,NSDigitalSignature
,NSCryptor
> {
27 + keyWithPrivateData
:(NSData
*)private
28 depth
:(unsigned)depth
// depth is in range 0-23
29 usageName
:(NSString
*)uname
;
30 // able to encrypt/decrypt data
31 // able to create/verify digital signatures
33 + keyWithPublicKeyString
:(NSString
*)hexstr
;
34 // able to encrypt data
35 // able to verify digital signatures
38 * Create new key with curve parameters matching existing oldKey.
40 + keyWithPrivateData
:(NSData
*)passwd
41 andKey
:(NSFEEPublicKey
*)oldKey
42 usageName
:(NSString
*)uname
;
45 * Convenience methods. The first three use the default depth
46 * (FEE_DEPTH_DEFAULT).
48 + keyWithPrivateData
:(NSData
*)passwd
49 usageName
:(NSString
*)uname
;
50 + keyWithPrivateString
:(NSString
*)private
51 usageName
:(NSString
*)uname
;
52 + keyWithPrivateString
:(NSString
*)private
53 andKey
:(NSFEEPublicKey
*)oldKey
54 usageName
:(NSString
*)uname
;
56 + keyWithPrivateString
:(NSString
*)private
58 usageName
:(NSString
*)uname
;
63 - (NSData
*)encryptData
:(NSData
*)data
; // done with public knowledge
64 - (NSData
*)decryptData
:(NSData
*)data
; // done with private knowledge
67 * NSDigitalSignature protocol
69 - (NSData
*)digitalSignatureForData
:(NSData
*)data
;
70 // data is hashed with MD5 and then signed with private knowledge
71 - (BOOL
)isValidDigitalSignature
:(NSData
*)sig forData
:(NSData
*)data
;
72 // data is hashed with MD5 and then verified with public knowledge