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 ***************************************************************************
11 * NSCryptors.h - common cryptographic protocols
15 * ??? 1994 Blaine Garst at NeXT
20 #import <Foundation/NSObject.h>
21 #import <Foundation/NSData.h>
22 #import <Foundation/NSString.h>
25 /************ Utilities ******************************************/
29 NSString
*NSPromptForPassPhrase(NSString
*prompt
);
30 // useful for command line (/dev/tty) programs
34 /************ Data Hashing Protocol *****************/
36 @protocol NSDataDigester
37 + digester
; // provides a concrete digester
40 - (void)digestData
:(NSData
*)data
; // use for multi-bite messages
41 - (NSData
*)messageDigest
; // provide digest; re-init
43 // conveniences that only use the above primitives
44 // all in one gulp (eats salt first, if present)
45 - (NSData
*)digestData
:(NSData
*)data withSalt
:(NSData
*)salt
;
50 /****** Encryption/Decryption Protocol ***********/
53 - (NSData
*)encryptData
:(NSData
*)input
;
54 - (NSData
*)decryptData
:(NSData
*)input
;
55 - (unsigned)keyBitsize
;
59 /*************** Public Key Services *************/
62 - (NSString
*)publicKeyString
;
63 - (NSString
*)algorithmName
; // "Diffie-Hellman" "FEE" ...
64 - (NSString
*)usageName
; // "Blaine Garst - home"
65 - (NSData
*)padWithPublicKey
:(id
<NSPublicKey
>)otherKey
;
66 - (unsigned)keyBitsize
;
69 /********* Key Ring ************************/
72 - keyForUsageName
:(NSString
*)user
;
75 /********** Digital Signatures **************/
77 // protocol adapted by various signature schemes (FEE, DSA, RSA...)
78 @protocol NSDigitalSignature
79 - (NSData
*)digitalSignatureForData
:(NSData
*)message
;
80 // generate a signature for the data
82 - (BOOL
)isValidDigitalSignature
:(NSData
*)sig forData
:(NSData
*)data
;