1 #ifndef __TRANSFORM_DIGEST__
2 #define __TRANSFORM_DIGEST__
6 * Copyright (c) 2010-2011 Apple Inc. All Rights Reserved.
8 * @APPLE_LICENSE_HEADER_START@
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
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.
25 * @APPLE_LICENSE_HEADER_END@
28 #include "SecTransform.h"
37 Specifies an MD2 digest
39 extern const CFStringRef kSecDigestMD2
;
43 Specifies an MD4 digest
45 extern const CFStringRef kSecDigestMD4
;
49 Specifies an MD5 digest
51 extern const CFStringRef kSecDigestMD5
;
55 Specifies a SHA1 digest
57 extern const CFStringRef kSecDigestSHA1
;
61 Specifies a SHA2 digest.
63 extern const CFStringRef kSecDigestSHA2
;
67 Specifies an HMAC using the MD5 digest algorithm.
69 extern const CFStringRef kSecDigestHMACMD5
;
73 Specifies an HMAC using the SHA1 digest algorithm.
75 extern const CFStringRef kSecDigestHMACSHA1
;
79 Specifies an HMAC using one of the SHA2 digest algorithms.
81 extern const CFStringRef kSecDigestHMACSHA2
;
85 @constant kSecDigestTypeAttribute
86 Used with SecTransformGetAttribute to query the attribute type.
87 Returns one of the strings defined in the previous section.
89 extern const CFStringRef kSecDigestTypeAttribute
;
92 @constant kSecDigestLengthAttribute
93 Used with SecTransformGetAttribute to query the length attribute.
94 Returns a CFNumberRef that contains the length.
96 extern const CFStringRef kSecDigestLengthAttribute
;
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
105 extern const CFStringRef kSecDigestHMACKeyAttribute
;
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
124 @discussion This function creates a transform which computes a
125 cryptographic digest.
128 SecTransformRef
SecDigestTransformCreate(CFTypeRef digestType
,
129 CFIndex digestLength
,
132 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_NA
);
136 @function SecDigestTransformGetTypeID
137 @abstract Return the CFTypeID of a SecDigestTransform
141 CFTypeID
SecDigestTransformGetTypeID()
142 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_NA
);