]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_cryptkit/lib/NSCipherFile.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / NSCipherFile.h
diff --git a/OSX/libsecurity_cryptkit/lib/NSCipherFile.h b/OSX/libsecurity_cryptkit/lib/NSCipherFile.h
new file mode 100644 (file)
index 0000000..13f103c
--- /dev/null
@@ -0,0 +1,111 @@
+/* Copyright (c) 1998,2011,2014 Apple Inc.  All Rights Reserved.
+ *
+ * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT
+ * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE
+ * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE, INC. AND THE
+ * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE,
+ * INC.  ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL
+ * EXPOSE YOU TO LIABILITY.
+ ***************************************************************************
+ *
+ * NSCipherFile.h - ObjC wrapper for feeCipherFile
+ *
+ * Revision History
+ * ----------------
+ * 28 Oct 96 at NeXT
+ *     Created.
+ */
+
+#import <CryptKit/CryptKit.h>
+#import <CryptKit/CipherFileTypes.h>
+
+@interface NSCipherFile : NSObject
+{
+       void    *_priv;
+}
+
+/*
+ * Alloc and return an autoreleased NSCipherFile object associated with
+ * the specified data.
+ */
++ newFromCipherText : (NSData *)cipherText
+       encrType : (cipherFileEncrType)encrType
+       sendPubKeyData : (NSData *)sendPubKeyData
+       otherKeyData : (NSData *)otherKeyData
+       sigData : (NSData *)sigData     // optional; nil means no signature
+       userData : (unsigned)userData;  // for caller's convenience
+
+/*
+ * Obtain the contents of a feeCipherFile as NSData.
+ */
+- (NSData *)dataRepresentation;
+
+/*
+ * Alloc and return an autoreleased NSCipherFile object given a data
+ * representation.
+ */
++ newFromDataRepresentation : (NSData *)dataRep;
+
+/*
+ * Given an NSCipherFile object, obtain its constituent parts.
+ */
+- (cipherFileEncrType)encryptionType;
+- (NSData *)cipherText;
+- (NSData *)sendPubKeyData;
+- (NSData *)otherKeyData;
+- (NSData *)sigData;
+- (unsigned)userData;
+
+/*
+ * High-level cipherFile support.
+ */
+
+/*
+ * Obtain the data representation of a NSCipherFile given the specified
+ * plainText and cipherFileEncrType.
+ * Receiver's public key is required for all encrTypes; sender's private
+ * key is required for signature generation and also for encrType
+ * CFE_PublicDES and CFE_FEED.
+ */
++(feeReturn)createCipherFileForPrivKey : (NSFEEPublicKey *)sendPrivKey
+       recvPubKey : (NSFEEPublicKey *)recvPubKey
+       encrType : (cipherFileEncrType)encrType
+       plainText : (NSData *)plainText
+       genSig : (BOOL)genSig
+       doEnc64 : (BOOL)doEnc64                 // YES ==> perform enc64
+       userData : (unsigned)userData           // for caller's convenience
+       cipherFileData : (NSData **)cipherFileData;     // RETURNED
+
+/*
+ * Parse and decrypt a data representation of an NSCipherFile object.
+ *
+ * recvPrivKey is required in all cases. If sendPubKey is present,
+ * sendPubKey - rather than the embedded sender's public key - will be
+ * used for signature validation.
+ */
++ (feeReturn)parseCipherFileData : (NSFEEPublicKey *)recvPrivKey
+       sendPubKey : (NSFEEPublicKey *)sendPubKey
+       cipherFileData : (NSData *)cipherFileData
+       doDec64 : (BOOL)doDec64
+       encrType : (cipherFileEncrType *)encrType       // RETURNED
+       plainText : (NSData **)plainText                // RETURNED
+       sigStatus : (feeSigStatus *)sigStatus           // RETURNED
+       sigSigner : (NSString **)sigSigner              // RETURNED
+       userData : (unsigned *)userData;                // RETURNED
+
+/*
+ * Parse and decrypt an NSCipherFile object obtained via
+ * +newFromDataRepresentation.
+ *
+ * recvPrivKey is required in all cases. If sendPubKey is present,
+ * sendPubKey - rather than the embedded sender's public key - will be
+ * used for signature validation.
+ */
+- (feeReturn)decryptCipherFileData : (NSFEEPublicKey *)recvPrivKey
+       sendPubKey : (NSFEEPublicKey *)sendPubKey
+       plainText : (NSData **)plainText                // RETURNED
+       sigStatus : (feeSigStatus *)sigStatus           // RETURNED
+       sigSigner : (NSString **)sigSigner;             // RETURNED
+
+
+@end