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 * NSCipherFile.h - ObjC wrapper for feeCipherFile
19 #import <CryptKit/CryptKit.h>
20 #import <CryptKit/CipherFileTypes.h>
22 @interface NSCipherFile
: NSObject
28 * Alloc and return an autoreleased NSCipherFile object associated with
31 + newFromCipherText
: (NSData
*)cipherText
32 encrType
: (cipherFileEncrType
)encrType
33 sendPubKeyData
: (NSData
*)sendPubKeyData
34 otherKeyData
: (NSData
*)otherKeyData
35 sigData
: (NSData
*)sigData
// optional; nil means no signature
36 userData
: (unsigned)userData
; // for caller's convenience
39 * Obtain the contents of a feeCipherFile as NSData.
41 - (NSData
*)dataRepresentation
;
44 * Alloc and return an autoreleased NSCipherFile object given a data
47 + newFromDataRepresentation
: (NSData
*)dataRep
;
50 * Given an NSCipherFile object, obtain its constituent parts.
52 - (cipherFileEncrType
)encryptionType
;
53 - (NSData
*)cipherText
;
54 - (NSData
*)sendPubKeyData
;
55 - (NSData
*)otherKeyData
;
60 * High-level cipherFile support.
64 * Obtain the data representation of a NSCipherFile given the specified
65 * plainText and cipherFileEncrType.
66 * Receiver's public key is required for all encrTypes; sender's private
67 * key is required for signature generation and also for encrType
68 * CFE_PublicDES and CFE_FEED.
70 +(feeReturn
)createCipherFileForPrivKey
: (NSFEEPublicKey
*)sendPrivKey
71 recvPubKey
: (NSFEEPublicKey
*)recvPubKey
72 encrType
: (cipherFileEncrType
)encrType
73 plainText
: (NSData
*)plainText
75 doEnc64
: (BOOL
)doEnc64
// YES ==> perform enc64
76 userData
: (unsigned)userData
// for caller's convenience
77 cipherFileData
: (NSData
**)cipherFileData
; // RETURNED
80 * Parse and decrypt a data representation of an NSCipherFile object.
82 * recvPrivKey is required in all cases. If sendPubKey is present,
83 * sendPubKey - rather than the embedded sender's public key - will be
84 * used for signature validation.
86 + (feeReturn
)parseCipherFileData
: (NSFEEPublicKey
*)recvPrivKey
87 sendPubKey
: (NSFEEPublicKey
*)sendPubKey
88 cipherFileData
: (NSData
*)cipherFileData
89 doDec64
: (BOOL
)doDec64
90 encrType
: (cipherFileEncrType
*)encrType
// RETURNED
91 plainText
: (NSData
**)plainText
// RETURNED
92 sigStatus
: (feeSigStatus
*)sigStatus
// RETURNED
93 sigSigner
: (NSString
**)sigSigner
// RETURNED
94 userData
: (unsigned *)userData
; // RETURNED
97 * Parse and decrypt an NSCipherFile object obtained via
98 * +newFromDataRepresentation.
100 * recvPrivKey is required in all cases. If sendPubKey is present,
101 * sendPubKey - rather than the embedded sender's public key - will be
102 * used for signature validation.
104 - (feeReturn
)decryptCipherFileData
: (NSFEEPublicKey
*)recvPrivKey
105 sendPubKey
: (NSFEEPublicKey
*)sendPubKey
106 plainText
: (NSData
**)plainText
// RETURNED
107 sigStatus
: (feeSigStatus
*)sigStatus
// RETURNED
108 sigSigner
: (NSString
**)sigSigner
; // RETURNED