3 * libsecurity_libSecOTR
5 * Created by Mitch Adler on 2/2/11.
6 * Copyright 2011 Apple Inc. All rights reserved.
14 * Message Protection interfaces
17 #include <CoreFoundation/CFBase.h>
18 #include <CoreFoundation/CFData.h>
19 #include <CoreFoundation/CFError.h>
20 #include <Security/SecKey.h>
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
31 typedef struct _SecOTRFullIdentity
* SecOTRFullIdentityRef
;
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
38 typedef struct _SecOTRPublicIdentity
* SecOTRPublicIdentityRef
;
41 * Full identity functions
43 SecOTRFullIdentityRef
SecOTRFullIdentityCreate(CFAllocatorRef allocator
, CFErrorRef
*error
);
45 SecOTRFullIdentityRef
SecOTRFullIdentityCreateFromSecKeyRef(CFAllocatorRef allocator
, SecKeyRef privateKey
,
47 SecOTRFullIdentityRef
SecOTRFullIdentityCreateFromData(CFAllocatorRef allocator
, CFDataRef serializedData
, CFErrorRef
*error
);
49 SecOTRFullIdentityRef
SecOTRFullIdentityCreateFromBytes(CFAllocatorRef allocator
, const uint8_t**bytes
, size_t *size
, CFErrorRef
*error
);
51 bool SecOTRFIPurgeFromKeychain(SecOTRFullIdentityRef thisID
, CFErrorRef
*error
);
53 bool SecOTRFIAppendSerialization(SecOTRFullIdentityRef fullID
, CFMutableDataRef serializeInto
, CFErrorRef
*error
);
56 bool SecOTRFIPurgeAllFromKeychain(CFErrorRef
*error
);
60 * Public identity functions
62 SecOTRPublicIdentityRef
SecOTRPublicIdentityCopyFromPrivate(CFAllocatorRef allocator
, SecOTRFullIdentityRef fullID
, CFErrorRef
*error
);
64 SecOTRPublicIdentityRef
SecOTRPublicIdentityCreateFromSecKeyRef(CFAllocatorRef allocator
, SecKeyRef publicKey
,
67 SecOTRPublicIdentityRef
SecOTRPublicIdentityCreateFromData(CFAllocatorRef allocator
, CFDataRef serializedData
, CFErrorRef
*error
);
68 SecOTRPublicIdentityRef
SecOTRPublicIdentityCreateFromBytes(CFAllocatorRef allocator
, const uint8_t**bytes
, size_t * size
, CFErrorRef
*error
);
70 bool SecOTRPIAppendSerialization(SecOTRPublicIdentityRef publicID
, CFMutableDataRef serializeInto
, CFErrorRef
*error
);
72 void SecOTRAdvertiseHashes(bool advertise
);