]> git.saurik.com Git - apple/security.git/blob - OSX/sec/Security/SecOTR.h
Security-58286.70.7.tar.gz
[apple/security.git] / OSX / sec / Security / SecOTR.h
1 /*
2 * Copyright (c) 2011-2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25 #ifndef _SECOTR_H_
26 #define _SECOTR_H_
27
28 /*
29 * Message Protection interfaces
30 */
31
32 #include <CoreFoundation/CFBase.h>
33 #include <CoreFoundation/CFData.h>
34 #include <CoreFoundation/CFError.h>
35 #include <Security/SecKey.h>
36
37 #include <stdint.h>
38
39 __BEGIN_DECLS
40
41 /*!
42 @typedef
43 @abstract Full identity (public and private) for Message Protection
44 @discussion Abstracts what kind of crypto is going on beyond it being public/priate
45 */
46 typedef struct _SecOTRFullIdentity* SecOTRFullIdentityRef;
47
48 /*!
49 @typedef
50 @abstract Public identity for Message Protection message validation and encryption to send
51 @discussion Abstracts what kind of crypto is going on beyond it being public/priate
52 */
53 typedef struct _SecOTRPublicIdentity* SecOTRPublicIdentityRef;
54
55 /*
56 * Full identity functions
57 */
58 SecOTRFullIdentityRef SecOTRFullIdentityCreate(CFAllocatorRef allocator, CFErrorRef *error);
59
60 SecOTRFullIdentityRef SecOTRFullIdentityCreateFromSecKeyRef(CFAllocatorRef allocator, SecKeyRef privateKey,
61 CFErrorRef *error);
62 SecOTRFullIdentityRef SecOTRFullIdentityCreateFromData(CFAllocatorRef allocator, CFDataRef serializedData, CFErrorRef *error);
63
64 SecOTRFullIdentityRef SecOTRFullIdentityCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t *size, CFErrorRef *error);
65
66 bool SecOTRFIPurgeFromKeychain(SecOTRFullIdentityRef thisID, CFErrorRef *error);
67
68 bool SecOTRFIAppendSerialization(SecOTRFullIdentityRef fullID, CFMutableDataRef serializeInto, CFErrorRef *error);
69
70
71 bool SecOTRFIPurgeAllFromKeychain(CFErrorRef *error);
72
73
74 /*
75 * Public identity functions
76 */
77 SecOTRPublicIdentityRef SecOTRPublicIdentityCopyFromPrivate(CFAllocatorRef allocator, SecOTRFullIdentityRef fullID, CFErrorRef *error);
78
79 SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromSecKeyRef(CFAllocatorRef allocator, SecKeyRef publicKey,
80 CFErrorRef *error);
81
82 SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromData(CFAllocatorRef allocator, CFDataRef serializedData, CFErrorRef *error);
83 SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t * size, CFErrorRef *error);
84
85 bool SecOTRPIAppendSerialization(SecOTRPublicIdentityRef publicID, CFMutableDataRef serializeInto, CFErrorRef *error);
86
87 void SecOTRAdvertiseHashes(bool advertise);
88
89 __END_DECLS
90
91 #endif