]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_transform/lib/EncryptTransformUtilities.h
Security-59306.101.1.tar.gz
[apple/security.git] / OSX / libsecurity_transform / lib / EncryptTransformUtilities.h
1 /*
2 * Copyright (c) 2010-2011 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /*!
25 @header EncryptTransformUtilities
26 This file contains utilities used by the SecEncryptTransform and the SecDecryptTransform
27
28 */
29 #if !defined(___ENCRYPT_TRANSFORM_UTILITIES__)
30 #define ___ENCRYPT_TRANSFORM_UTILITIES__ 1
31
32 #include <CoreFoundation/CoreFoundation.h>
33 #include <Security/cssmapi.h>
34 #include <Security/cssmapple.h>
35 #include <Security/cssmtype.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 /*!
42 @function ConvertPaddingStringToEnum
43 @abstract Given a string that represents a padding return the
44 CSSM_PADDING value
45 @param paddingStr A CFStringRef that represents a padding string
46 @result The corresponding CSSM_PADDING value or -1 if the
47 padding value could not be found
48 */
49 uint32 ConvertPaddingStringToEnum(CFStringRef paddingStr);
50
51 /*!
52 @function ConvertPaddingEnumToString
53 @abstract Given a CSSM_PADDING value return the corresponding
54 CFString representation.
55 @param paddingEnum A CSSM_PADDING value.
56 @result The corresponding CFStringRef or NULL if the the
57 CSSM_PADDING value could not be found
58 */
59 CFStringRef ConvertPaddingEnumToString(CSSM_PADDING paddingEnum);
60
61
62 /*!
63 @function ConvertEncryptModeStringToEnum
64 @abstract Given a string that represents an encryption mode return the
65 CSSM_ENCRYPT_MODE value
66 @param modeStr A CFStringRef that represents an encryption mode
67 @param hasPadding Specify if the mode should pad
68 @result The corresponding CSSM_ENCRYPT_MODE value or -1 if the
69 encryptio mode value could not be found
70 */
71 uint32 ConvertEncryptModeStringToEnum(CFStringRef modeStr, Boolean hasPadding);
72
73 /*!
74 @function ConvertPaddingEnumToString
75 @abstract Given a CSSM_ENCRYPT_MODE value return the corresponding
76 CFString representation.
77 @param paddingEnum A CSSM_ENCRYPT_MODE value.
78 @result The corresponding CFStringRef or NULL if the the
79 CSSM_ENCRYPT_MODE value could not be found
80 */
81 CFStringRef ConvertEncryptModeEnumToString(CSSM_ENCRYPT_MODE paddingEnum);
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif /* !___ENCRYPT_TRANSFORM_UTILITIES__ */