]> git.saurik.com Git - apple/security.git/blame - sec/Security/SecOTR.h
Security-55471.14.18.tar.gz
[apple/security.git] / sec / Security / SecOTR.h
CommitLineData
427c49bc
A
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*/
31typedef 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 */
38typedef struct _SecOTRPublicIdentity* SecOTRPublicIdentityRef;
39
40/*
41 * Full identity functions
42 */
43SecOTRFullIdentityRef SecOTRFullIdentityCreate(CFAllocatorRef allocator, CFErrorRef *error);
44
45SecOTRFullIdentityRef SecOTRFullIdentityCreateFromSecKeyRef(CFAllocatorRef allocator, SecKeyRef privateKey,
46 CFErrorRef *error);
47SecOTRFullIdentityRef SecOTRFullIdentityCreateFromData(CFAllocatorRef allocator, CFDataRef serializedData, CFErrorRef *error);
48
49SecOTRFullIdentityRef SecOTRFullIdentityCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t *size, CFErrorRef *error);
50
51bool SecOTRFIPurgeFromKeychain(SecOTRFullIdentityRef thisID, CFErrorRef *error);
52
53bool SecOTRFIAppendSerialization(SecOTRFullIdentityRef fullID, CFMutableDataRef serializeInto, CFErrorRef *error);
54
55
56bool SecOTRFIPurgeAllFromKeychain(CFErrorRef *error);
57
58
59/*
60 * Public identity functions
61 */
62SecOTRPublicIdentityRef SecOTRPublicIdentityCopyFromPrivate(CFAllocatorRef allocator, SecOTRFullIdentityRef fullID, CFErrorRef *error);
63
64SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromSecKeyRef(CFAllocatorRef allocator, SecKeyRef publicKey,
65 CFErrorRef *error);
66
67SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromData(CFAllocatorRef allocator, CFDataRef serializedData, CFErrorRef *error);
68SecOTRPublicIdentityRef SecOTRPublicIdentityCreateFromBytes(CFAllocatorRef allocator, const uint8_t**bytes, size_t * size, CFErrorRef *error);
69
70bool SecOTRPIAppendSerialization(SecOTRPublicIdentityRef publicID, CFMutableDataRef serializeInto, CFErrorRef *error);
71
72void SecOTRAdvertiseHashes(bool advertise);
73
74__END_DECLS
75
76#endif