]> git.saurik.com Git - apple/security.git/blame - libsecurity_transform/lib/SecDigestTransform.h
Security-55471.14.18.tar.gz
[apple/security.git] / libsecurity_transform / lib / SecDigestTransform.h
CommitLineData
b1ab9ed8
A
1#ifndef __TRANSFORM_DIGEST__
2#define __TRANSFORM_DIGEST__
3
4
5/*
6 * Copyright (c) 2010 Apple Inc. All Rights Reserved.
7 *
8 * @APPLE_LICENSE_HEADER_START@
9 *
10 * This file contains Original Code and/or Modifications of Original Code
11 * as defined in and that are subject to the Apple Public Source License
12 * Version 2.0 (the 'License'). You may not use this file except in
13 * compliance with the License. Please obtain a copy of the License at
14 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * file.
16 *
17 * The Original Code and all software distributed under the License are
18 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
19 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
20 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
22 * Please see the License for the specific language governing rights and
23 * limitations under the License.
24 *
25 * @APPLE_LICENSE_HEADER_END@
26 */
27
28#include "SecTransform.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/*!
36 @abstract
37 Specifies an MD2 digest
38*/
39extern const CFStringRef kSecDigestMD2;
40
41/*!
42 @abstract
43 Specifies an MD4 digest
44 */
45extern const CFStringRef kSecDigestMD4;
46
47/*!
48 @abstract
49 Specifies an MD5 digest
50 */
51extern const CFStringRef kSecDigestMD5;
52
53/*!
54 @abstract
55 Specifies a SHA1 digest
56 */
57extern const CFStringRef kSecDigestSHA1;
58
59/*!
60 @abstract
61 Specifies a SHA2 digest.
62 */
63extern const CFStringRef kSecDigestSHA2;
64
65/*!
66 @abstract
67 Specifies an HMAC using the MD5 digest algorithm.
68 */
69extern const CFStringRef kSecDigestHMACMD5;
70
71/*!
72 @abstract
73 Specifies an HMAC using the SHA1 digest algorithm.
74 */
75extern const CFStringRef kSecDigestHMACSHA1;
76
77/*!
78 @abstract
79 Specifies an HMAC using one of the SHA2 digest algorithms.
80 */
81extern const CFStringRef kSecDigestHMACSHA2;
82
83
84/*!
85 @constant kSecDigestTypeAttribute
86 Used with SecTransformGetAttribute to query the attribute type.
87 Returns one of the strings defined in the previous section.
88 */
89extern const CFStringRef kSecDigestTypeAttribute;
90
91/*!
92 @constant kSecDigestLengthAttribute
93 Used with SecTransformGetAttribute to query the length attribute.
94 Returns a CFNumberRef that contains the length.
95 */
96extern const CFStringRef kSecDigestLengthAttribute;
97
98/*!
99 @constant kSecDigestHMACKeyAttribute
100 When set and used with one of the HMAC digest types, sets the key
101 for the HMAC operation. The data type for this attribute must be
102 a CFDataRef. If this value is not set, the transform will assume
103 a zero length key.
104*/
105extern const CFStringRef kSecDigestHMACKeyAttribute;
106
107/*!
108 @function SecDigestTransformCreate
109 @abstract Creates a digest computation object.
110 @param digestType The type of digest to compute. You may pass NULL
111 for this parameter, in which case an appropriate
112 algorithm will be chosen for you.
113 @param digestLength The desired digest length. Note that certain
114 algorithms may only support certain sizes. You may
115 pass 0 for this parameter, in which case an
116 appropriate length will be chosen for you.
117 @param error A pointer to a CFErrorRef. This pointer will be set
118 if an error occurred. This value may be NULL if you
119 do not want an error returned.
120 @result A pointer to a SecTransformRef object. This object must
121 be released with CFRelease when you are done with
122 it. This function will return NULL if an error
123 occurred.
124 @discussion This function creates a transform which computes a
125 cryptographic digest.
126*/
127
128SecTransformRef SecDigestTransformCreate(CFTypeRef digestType,
129 CFIndex digestLength,
130 CFErrorRef* error
131 )
132 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA);
133
134
135/*!
136 @function SecDigestTransformGetTypeID
137 @abstract Return the CFTypeID of a SecDigestTransform
138 @result The CFTypeID
139*/
140
141CFTypeID SecDigestTransformGetTypeID()
142 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA);
143
144
145#ifdef __cplusplus
146};
147#endif
148
149
150#endif