]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_transform/lib/SecDigestTransform.h
Security-59754.41.1.tar.gz
[apple/security.git] / OSX / libsecurity_transform / lib / SecDigestTransform.h
1 #ifndef __TRANSFORM_DIGEST__
2 #define __TRANSFORM_DIGEST__
3
4
5 /*
6 * Copyright (c) 2010-2011 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 <Security/SecTransform.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 CF_ASSUME_NONNULL_BEGIN
35 CF_IMPLICIT_BRIDGING_ENABLED
36
37 /*!
38 @abstract
39 Specifies an MD2 digest
40 */
41 extern const CFStringRef kSecDigestMD2;
42
43 /*!
44 @abstract
45 Specifies an MD4 digest
46 */
47 extern const CFStringRef kSecDigestMD4;
48
49 /*!
50 @abstract
51 Specifies an MD5 digest
52 */
53 extern const CFStringRef kSecDigestMD5;
54
55 /*!
56 @abstract
57 Specifies a SHA1 digest
58 */
59 extern const CFStringRef kSecDigestSHA1;
60
61 /*!
62 @abstract
63 Specifies a SHA2 digest.
64 */
65 extern const CFStringRef kSecDigestSHA2;
66
67 /*!
68 @abstract
69 Specifies an HMAC using the MD5 digest algorithm.
70 */
71 extern const CFStringRef kSecDigestHMACMD5;
72
73 /*!
74 @abstract
75 Specifies an HMAC using the SHA1 digest algorithm.
76 */
77 extern const CFStringRef kSecDigestHMACSHA1;
78
79 /*!
80 @abstract
81 Specifies an HMAC using one of the SHA2 digest algorithms.
82 */
83 extern const CFStringRef kSecDigestHMACSHA2;
84
85
86 /*!
87 @constant kSecDigestTypeAttribute
88 Used with SecTransformGetAttribute to query the attribute type.
89 Returns one of the strings defined in the previous section.
90 */
91 extern const CFStringRef kSecDigestTypeAttribute;
92
93 /*!
94 @constant kSecDigestLengthAttribute
95 Used with SecTransformGetAttribute to query the length attribute.
96 Returns a CFNumberRef that contains the length in bytes.
97 */
98 extern const CFStringRef kSecDigestLengthAttribute;
99
100 /*!
101 @constant kSecDigestHMACKeyAttribute
102 When set and used with one of the HMAC digest types, sets the key
103 for the HMAC operation. The data type for this attribute must be
104 a CFDataRef. If this value is not set, the transform will assume
105 a zero length key.
106 */
107 extern const CFStringRef kSecDigestHMACKeyAttribute;
108
109 /*!
110 @function SecDigestTransformCreate
111 @abstract Creates a digest computation object.
112 @param digestType The type of digest to compute. You may pass NULL
113 for this parameter, in which case an appropriate
114 algorithm will be chosen for you.
115 @param digestLength The desired digest length. Note that certain
116 algorithms may only support certain sizes. You may
117 pass 0 for this parameter, in which case an
118 appropriate length will be chosen for you.
119 @param error A pointer to a CFErrorRef. This pointer will be set
120 if an error occurred. This value may be NULL if you
121 do not want an error returned.
122 @result A pointer to a SecTransformRef object. This object must
123 be released with CFRelease when you are done with
124 it. This function will return NULL if an error
125 occurred.
126 @discussion This function creates a transform which computes a
127 cryptographic digest.
128 */
129
130 SecTransformRef SecDigestTransformCreate(CFTypeRef __nullable digestType,
131 CFIndex digestLength,
132 CFErrorRef* error
133 )
134 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA);
135
136
137 /*!
138 @function SecDigestTransformGetTypeID
139 @abstract Return the CFTypeID of a SecDigestTransform
140 @result The CFTypeID
141 */
142
143 CFTypeID SecDigestTransformGetTypeID(void)
144 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA);
145
146 CF_IMPLICIT_BRIDGING_DISABLED
147 CF_ASSUME_NONNULL_END
148
149 #ifdef __cplusplus
150 };
151 #endif
152
153
154 #endif