X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/Security/libsecurity_cryptkit/lib/NSCryptors.h diff --git a/Security/libsecurity_cryptkit/lib/NSCryptors.h b/Security/libsecurity_cryptkit/lib/NSCryptors.h new file mode 100644 index 00000000..33935a7d --- /dev/null +++ b/Security/libsecurity_cryptkit/lib/NSCryptors.h @@ -0,0 +1,83 @@ +/* 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. + *************************************************************************** + * + * NSCryptors.h - common cryptographic protocols + * + * Revision History + * ---------------- + * ??? 1994 Blaine Garst at NeXT + * Created. + */ + + +#import +#import +#import + + +/************ Utilities ******************************************/ + +#ifdef NeXT + +NSString *NSPromptForPassPhrase(NSString *prompt); + // useful for command line (/dev/tty) programs + +#endif NeXT + +/************ Data Hashing Protocol *****************/ + +@protocol NSDataDigester ++ digester; // provides a concrete digester + +// primitives +- (void)digestData:(NSData *)data; // use for multi-bite messages +- (NSData *)messageDigest; // provide digest; re-init + +// conveniences that only use the above primitives +// all in one gulp (eats salt first, if present) +- (NSData *)digestData:(NSData *)data withSalt:(NSData *)salt; + +@end + + +/****** Encryption/Decryption Protocol ***********/ + +@protocol NSCryptor +- (NSData *)encryptData:(NSData *)input; +- (NSData *)decryptData:(NSData *)input; +- (unsigned)keyBitsize; +@end + + +/*************** Public Key Services *************/ + +@protocol NSPublicKey +- (NSString *)publicKeyString; +- (NSString *)algorithmName; // "Diffie-Hellman" "FEE" ... +- (NSString *)usageName; // "Blaine Garst - home" +- (NSData *)padWithPublicKey:(id )otherKey; +- (unsigned)keyBitsize; +@end + +/********* Key Ring ************************/ + +@protocol NSKeyRing +- keyForUsageName:(NSString *)user; +@end + +/********** Digital Signatures **************/ + +// protocol adapted by various signature schemes (FEE, DSA, RSA...) +@protocol NSDigitalSignature +- (NSData *)digitalSignatureForData:(NSData *)message; + // generate a signature for the data + +- (BOOL)isValidDigitalSignature:(NSData *)sig forData:(NSData *)data; +@end