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 <Security/SecTransform.h>
34 CF_ASSUME_NONNULL_BEGIN
35 CF_IMPLICIT_BRIDGING_ENABLED
39 Specifies an MD2 digest
41 extern const CFStringRef kSecDigestMD2
;
45 Specifies an MD4 digest
47 extern const CFStringRef kSecDigestMD4
;
51 Specifies an MD5 digest
53 extern const CFStringRef kSecDigestMD5
;
57 Specifies a SHA1 digest
59 extern const CFStringRef kSecDigestSHA1
;
63 Specifies a SHA2 digest.
65 extern const CFStringRef kSecDigestSHA2
;
69 Specifies an HMAC using the MD5 digest algorithm.
71 extern const CFStringRef kSecDigestHMACMD5
;
75 Specifies an HMAC using the SHA1 digest algorithm.
77 extern const CFStringRef kSecDigestHMACSHA1
;
81 Specifies an HMAC using one of the SHA2 digest algorithms.
83 extern const CFStringRef kSecDigestHMACSHA2
;
87 @constant kSecDigestTypeAttribute
88 Used with SecTransformGetAttribute to query the attribute type.
89 Returns one of the strings defined in the previous section.
91 extern const CFStringRef kSecDigestTypeAttribute
;
94 @constant kSecDigestLengthAttribute
95 Used with SecTransformGetAttribute to query the length attribute.
96 Returns a CFNumberRef that contains the length in bytes.
98 extern const CFStringRef kSecDigestLengthAttribute
;
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
107 extern const CFStringRef kSecDigestHMACKeyAttribute
;
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
126 @discussion This function creates a transform which computes a
127 cryptographic digest.
130 SecTransformRef
SecDigestTransformCreate(CFTypeRef __nullable digestType
,
131 CFIndex digestLength
,
134 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_NA
);
138 @function SecDigestTransformGetTypeID
139 @abstract Return the CFTypeID of a SecDigestTransform
143 CFTypeID
SecDigestTransformGetTypeID(void)
144 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_NA
);
146 CF_IMPLICIT_BRIDGING_DISABLED
147 CF_ASSUME_NONNULL_END