]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_transform/lib/SecSignVerifyTransform.h
Security-58286.51.6.tar.gz
[apple/security.git] / OSX / libsecurity_transform / lib / SecSignVerifyTransform.h
1 #ifndef __TRANSFORM_SIGN_VERIFY__
2 #define __TRANSFORM_SIGN_VERIFY__
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 "SecTransform.h"
29 #include <Security/SecBase.h>
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 CF_ASSUME_NONNULL_BEGIN
37 CF_IMPLICIT_BRIDGING_ENABLED
38
39 extern const CFStringRef kSecKeyAttributeName, kSecSignatureAttributeName, kSecInputIsAttributeName;
40 // WARNING: kSecInputIsRaw is frequently cryptographically unsafe (for example if you don't blind a DSA or ECDSA signature you give away the key very quickly), please only use it if you really know the math.
41 extern const CFStringRef kSecInputIsPlainText, kSecInputIsDigest, kSecInputIsRaw;
42 // Supported optional attributes: kSecDigestTypeAttribute (kSecDigestMD2, kSecDigestMD4, kSecDigestMD5, kSecDigestSHA1, kSecDigestSHA2), kSecDigestLengthAttribute
43
44 /*!
45 @function SecSignTransformCreate
46 @abstract Creates a sign computation object.
47 @param key A SecKey with the private key used for signing.
48 @param error A pointer to a CFErrorRef. This pointer will be set
49 if an error occurred. This value may be NULL if you
50 do not want an error returned.
51 @result A pointer to a SecTransformRef object. This object must
52 be released with CFRelease when you are done with
53 it. This function will return NULL if an error
54 occurred.
55 @discussion This function creates a transform which computes a
56 cryptographic signature. The InputIS defaults to kSecInputIsPlainText,
57 and the DigestType and DigestLength default to something appropriate for
58 the type of key you have supplied.
59 */
60
61 __nullable
62 SecTransformRef SecSignTransformCreate(SecKeyRef key,
63 CFErrorRef* error
64 )
65 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA);
66
67 /*!
68 @function SecVerifyTransformCreate
69 @abstract Creates a verify computation object.
70 @param key A SecKey with the public key used for signing.
71 @param signature A CFDataRef with the signature. This value may be
72 NULL, and you may connect a transform to kSecTransformSignatureAttributeName
73 to supply it from another signature.
74 @param error A pointer to a CFErrorRef. This pointer will be set
75 if an error occurred. This value may be NULL if you
76 do not want an error returned.
77 @result A pointer to a SecTransformRef object. This object must
78 be released with CFRelease when you are done with
79 it. This function will return NULL if an error
80 occurred.
81 @discussion This function creates a transform which verifies a
82 cryptographic signature. The InputIS defaults to kSecInputIsPlainText,
83 and the DigestType and DigestLength default to something appropriate for
84 the type of key you have supplied.
85 */
86
87 __nullable
88 SecTransformRef SecVerifyTransformCreate(SecKeyRef key,
89 CFDataRef __nullable signature,
90 CFErrorRef* error
91 )
92 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_NA);
93
94 CF_IMPLICIT_BRIDGING_DISABLED
95 CF_ASSUME_NONNULL_END
96
97 #ifdef __cplusplus
98 };
99 #endif
100
101
102 #endif