objc2_security/generated/SecEncryptTransform.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8extern "C" {
9 /// Indicates that no padding will be used when encrypting or decrypting.
10 ///
11 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingnonekey?language=objc)
12 pub static kSecPaddingNoneKey: &'static CFString;
13}
14
15extern "C" {
16 /// Indicates that PKCS1 padding will be used when encrypting or decrypting.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingpkcs1key?language=objc)
19 pub static kSecPaddingPKCS1Key: &'static CFString;
20}
21
22extern "C" {
23 /// Indicates that PKCS5 padding will be used when encrypting or decrypting.
24 ///
25 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingpkcs5key?language=objc)
26 pub static kSecPaddingPKCS5Key: &'static CFString;
27}
28
29extern "C" {
30 /// Indicates that PKCS7 padding will be used when encrypting or decrypting.
31 ///
32 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingpkcs7key?language=objc)
33 pub static kSecPaddingPKCS7Key: &'static CFString;
34}
35
36extern "C" {
37 /// Indicates that PKCS7 padding will be used when encrypting or decrypting.
38 ///
39 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingoaepkey?language=objc)
40 pub static kSecPaddingOAEPKey: &'static CFString;
41}
42
43extern "C" {
44 /// Indicates that no mode will be used when encrypting or decrypting.
45 ///
46 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodenonekey?language=objc)
47 pub static kSecModeNoneKey: &'static CFString;
48}
49
50extern "C" {
51 /// Indicates that ECB mode will be used when encrypting or decrypting.
52 ///
53 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodeecbkey?language=objc)
54 pub static kSecModeECBKey: &'static CFString;
55}
56
57extern "C" {
58 /// Indicates that CBC mode will be used when encrypting or decrypting.
59 ///
60 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodecbckey?language=objc)
61 pub static kSecModeCBCKey: &'static CFString;
62}
63
64extern "C" {
65 /// Indicates that CFB mode will be used when encrypting or decrypting.
66 ///
67 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodecfbkey?language=objc)
68 pub static kSecModeCFBKey: &'static CFString;
69}
70
71extern "C" {
72 /// Indicates that OFB mode will be used when encrypting or decrypting.
73 ///
74 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodeofbkey?language=objc)
75 pub static kSecModeOFBKey: &'static CFString;
76}
77
78extern "C" {
79 /// This attribute holds the encryption key for the transform. (ReadOnly)
80 ///
81 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecencryptkey?language=objc)
82 pub static kSecEncryptKey: &'static CFString;
83}
84
85extern "C" {
86 /// Key for setting padding.
87 ///
88 /// This key is optional. If you do not supply a value for this key,
89 /// an appropriate value will be supplied for you.
90 ///
91 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingkey?language=objc)
92 pub static kSecPaddingKey: &'static CFString;
93}
94
95extern "C" {
96 /// Key for setting an initialization vector.
97 ///
98 /// This key is optional. If you do not supply a
99 /// value for this key, an appropriate value will be supplied for you.
100 ///
101 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecivkey?language=objc)
102 pub static kSecIVKey: &'static CFString;
103}
104
105extern "C" {
106 /// Specifies the encryption mode.
107 ///
108 /// This key is optional. If you do not supply this key,
109 /// an appropriate value will be supplied for you.
110 ///
111 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecencryptionmode?language=objc)
112 pub static kSecEncryptionMode: &'static CFString;
113}
114
115extern "C" {
116 /// Specifies the OAEP message length.
117 ///
118 /// This should be set to a CFNumberRef when the padding is set to OAEP,
119 /// and a specific messages size is desired. If unset the minimum padding
120 /// will be added. It is ignored when the padding mode is not OAEP.
121 ///
122 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecoaepmessagelengthattributename?language=objc)
123 pub static kSecOAEPMessageLengthAttributeName: &'static CFString;
124}
125
126extern "C" {
127 /// Specifies the OAEP encoding paramaters
128 ///
129 /// This should be set to a CFDataRef when the padding is set to OAEP.
130 /// If unset a zero length CFDataRef is used. It is ignored by non
131 /// OAEP padding modes.
132 ///
133 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecoaepencodingparametersattributename?language=objc)
134 pub static kSecOAEPEncodingParametersAttributeName: &'static CFString;
135}
136
137extern "C" {
138 /// Specifies the OAEP MGF1 digest algorithm.
139 ///
140 /// This should be set to a digest algorithm when the padding is set to OAEP.
141 /// If unset SHA1 is used. It is ifnored by non OAEP padding modes.
142 ///
143 /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecoaepmgf1digestalgorithmattributename?language=objc)
144 pub static kSecOAEPMGF1DigestAlgorithmAttributeName: &'static CFString;
145}
146
147/// Creates an encryption SecTransform object.
148///
149/// Parameter `keyRef`: The key for the encryption operation
150///
151/// Parameter `error`: A pointer to a CFErrorRef. This pointer will be set
152/// if an error occurred. This value may be NULL if you
153/// do not want an error returned.
154///
155/// Returns: A pointer to a SecTransformRef object. This object must
156/// be released with CFRelease when you are done with
157/// it. This function will return NULL if an error
158/// occurred.
159///
160/// This function creates a transform which encrypts data.
161#[cfg(all(feature = "SecBase", feature = "SecTransform"))]
162#[deprecated = "SecTransform is no longer supported"]
163#[inline]
164pub unsafe extern "C-unwind" fn SecEncryptTransformCreate(
165 key_ref: &SecKey,
166 error: *mut *mut CFError,
167) -> CFRetained<SecTransform> {
168 extern "C-unwind" {
169 fn SecEncryptTransformCreate(
170 key_ref: &SecKey,
171 error: *mut *mut CFError,
172 ) -> Option<NonNull<SecTransform>>;
173 }
174 let ret = unsafe { SecEncryptTransformCreate(key_ref, error) };
175 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
176 unsafe { CFRetained::from_raw(ret) }
177}
178
179/// Creates an encryption SecTransform object.
180///
181/// Parameter `keyRef`: The key for the operation
182///
183/// Parameter `error`: A pointer to a CFErrorRef. This pointer will be set
184/// if an error occurred. This value may be NULL if you
185/// do not want an error returned.
186///
187/// Returns: A pointer to a SecTransformRef object. This object must
188/// be released with CFRelease when you are done with
189/// it. This function will return NULL if an error
190/// occurred.
191///
192/// This function creates a transform which encrypts data.
193#[cfg(all(feature = "SecBase", feature = "SecTransform"))]
194#[deprecated = "SecTransform is no longer supported"]
195#[inline]
196pub unsafe extern "C-unwind" fn SecDecryptTransformCreate(
197 key_ref: &SecKey,
198 error: *mut *mut CFError,
199) -> CFRetained<SecTransform> {
200 extern "C-unwind" {
201 fn SecDecryptTransformCreate(
202 key_ref: &SecKey,
203 error: *mut *mut CFError,
204 ) -> Option<NonNull<SecTransform>>;
205 }
206 let ret = unsafe { SecDecryptTransformCreate(key_ref, error) };
207 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
208 unsafe { CFRetained::from_raw(ret) }
209}
210
211/// Returns the CFTypeID for a decrypt transform.
212///
213/// Returns: the CFTypeID
214#[deprecated = "SecTransform is no longer supported"]
215#[inline]
216pub extern "C-unwind" fn SecDecryptTransformGetTypeID() -> CFTypeID {
217 extern "C-unwind" {
218 fn SecDecryptTransformGetTypeID() -> CFTypeID;
219 }
220 unsafe { SecDecryptTransformGetTypeID() }
221}
222
223/// Returns the CFTypeID for a decrypt transform.
224///
225/// Returns: the CFTypeID
226#[deprecated = "SecTransform is no longer supported"]
227#[inline]
228pub extern "C-unwind" fn SecEncryptTransformGetTypeID() -> CFTypeID {
229 extern "C-unwind" {
230 fn SecEncryptTransformGetTypeID() -> CFTypeID;
231 }
232 unsafe { SecEncryptTransformGetTypeID() }
233}