]> git.saurik.com Git - apple/security.git/blob - sec/Security/SecOTR.h
Security-55471.14.8.tar.gz
[apple/security.git] / sec / Security / SecOTR.h
1 /*
2 * SecOTR.h
3 * libsecurity_libSecOTR
4 *
5 * Created by Mitch Adler on 2/2/11.
6 * Copyright 2011 Apple Inc. All rights reserved.
7 *
8 */
9
10 #ifndef _SECOTR_H_
11 #define _SECOTR_H_
12
13 /*
14 * Message Protection interfaces
15 */
16
17 #include <CoreFoundation/CFBase.h>
18 #include <CoreFoundation/CFData.h>
19 #include <CoreFoundation/CFError.h>
20 #include <Security/SecKey.h>
21
22 #include <stdint.h>
23
24 __BEGIN_DECLS
25
26 /*!
27 @typedef
28 @abstract Full identity (public and private) for Message Protection
29 @discussion Abstracts what kind of crypto is going on beyond it being public/priate
30 */
31 typedef struct _SecOTRFullIdentity* SecOTRFullIdentityRef;
32
33 /*!
34 @typedef
35 @abstract Public identity for Message Protection message validation and encryption to send
36 @discussion Abstracts what kind of crypto is going on beyond it being public/priate
37 */
38 typedef struct _SecOTRPublicIdentity* SecOTRPublicIdentityRef;
39
40 /*
41 * Full identity functions
42 */
43 SecOTRFullIdentityRef SecOTRFullIdentityCreate(CFAllocatorRef allocator, CFErrorRef *error);
44
45 SecOTRFullIdentityRef SecOTRFullIdentityCreateFromSecKeyRef(CFAllocatorRef allocator, SecKeyRef privateKey,
46 CFErrorRef *error);
47 SecOTRFullIdentityRef SecOTRFullIdentityCreateFromData(CFAllocatorRef allocator, CFDataRef serializedData, CFErrorRef *error);
48
49 SecOTRFullIdentityRef SecOTRFullIdentityCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t *size, CFErrorRef *error);
50
51 bool SecOTRFIPurgeFromKeychain(SecOTRFullIdentityRef thisID, CFErrorRef *error);
52
53 bool SecOTRFIAppendSerialization(SecOTRFullIdentityRef fullID, CFMutableDataRef serializeInto, CFErrorRef *error);
54
55
56 bool SecOTRFIPurgeAllFromKeychain(CFErrorRef *error);
57
58
59 /*
60 * Public identity functions
61 */
62 SecOTRPublicIdentityRef SecOTRPublicIdentityCopyFromPrivate(CFAllocatorRef allocator, SecOTRFullIdentityRef fullID, CFErrorRef *error);
63
64 SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromSecKeyRef(CFAllocatorRef allocator, SecKeyRef publicKey,
65 CFErrorRef *error);
66
67 SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromData(CFAllocatorRef allocator, CFDataRef serializedData, CFErrorRef *error);
68 SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t * size, CFErrorRef *error);
69
70 bool SecOTRPIAppendSerialization(SecOTRPublicIdentityRef publicID, CFMutableDataRef serializeInto, CFErrorRef *error);
71
72 void SecOTRAdvertiseHashes(bool advertise);
73
74 __END_DECLS
75
76 #endif