objc2_local_authentication/generated/LAPrivateKey.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-security")]
8use objc2_security::*;
9
10use crate::*;
11
12extern_class!(
13 /// Managed Private Key.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/laprivatekey?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct LAPrivateKey;
19);
20
21unsafe impl NSObjectProtocol for LAPrivateKey {}
22
23impl LAPrivateKey {
24 extern_methods!(
25 #[cfg(feature = "LAPublicKey")]
26 /// Offers the public key counterpart of a
27 /// `LAPrivateKey`instance
28 #[unsafe(method(publicKey))]
29 #[unsafe(method_family = none)]
30 pub unsafe fn publicKey(&self) -> Retained<LAPublicKey>;
31
32 #[cfg(all(feature = "block2", feature = "objc2-security"))]
33 /// Generates a digital signature for the given data.
34 ///
35 /// Parameter `data`: The data to be signed, typically the digest of the actual data.
36 ///
37 /// Parameter `algorithm`: A
38 /// `SecKeyAlgorithm`suitable for generating signatures with this key – e.g:
39 /// `kSecKeyAlgorithmECDSASignatureMessageX962SHA256`
40 /// Parameter `handler`: Completion handler with the signature of given data or an error on failure.
41 #[unsafe(method(signData:secKeyAlgorithm:completion:))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn signData_secKeyAlgorithm_completion(
44 &self,
45 data: &NSData,
46 algorithm: &SecKeyAlgorithm,
47 handler: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
48 );
49
50 #[cfg(feature = "objc2-security")]
51 /// Checks if the the provided algorithm can be used for signing data
52 ///
53 /// Parameter `algorithm`: Cryptographic algorithm
54 ///
55 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
56 #[unsafe(method(canSignUsingSecKeyAlgorithm:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn canSignUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
59
60 #[cfg(all(feature = "block2", feature = "objc2-security"))]
61 /// Decrypts the given ciphertext
62 ///
63 /// Parameter `data`: The data to decrypt. The length and format of the data must conform to chosen algorithm,
64 /// typically be less or equal to the value returned by SecKeyGetBlockSize().
65 ///
66 /// Parameter `algorithm`: A
67 /// `SecKeyAlgorithm`suitable for decrypting data with this key –e.g:
68 /// `kSecKeyAlgorithmECIESEncryptionStandardVariableIVX963SHA256AESGCM`
69 /// Parameter `handler`: Completion handler with plaintext or an error on failure.
70 #[unsafe(method(decryptData:secKeyAlgorithm:completion:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn decryptData_secKeyAlgorithm_completion(
73 &self,
74 data: &NSData,
75 algorithm: &SecKeyAlgorithm,
76 handler: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
77 );
78
79 #[cfg(feature = "objc2-security")]
80 /// Checks if the the provided algorithm can be used for decryption
81 ///
82 /// Parameter `algorithm`: Cryptographic algorithm
83 ///
84 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
85 #[unsafe(method(canDecryptUsingSecKeyAlgorithm:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn canDecryptUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
88
89 #[cfg(all(feature = "block2", feature = "objc2-security"))]
90 /// Performs a Diffie-Hellman style key exchange operation
91 ///
92 /// Parameter `publicKey`: Remote party's public key.
93 ///
94 /// Parameter `algorithm`: A
95 /// `SecKeyAlgorithm`suitable for performing a key exchange with this key –e.g:
96 /// `kSecKeyAlgorithmECDHKeyExchangeCofactorX963SHA256`
97 /// Parameter `parameters`: Dictionary with parameters, see
98 /// `SecKeyKeyExchangeParameter`constants. Used algorithm determines the set of required and optional parameters to be used.
99 ///
100 /// Parameter `handler`: Completion handler with the result of the key exchange or an error on failure.
101 #[unsafe(method(exchangeKeysWithPublicKey:secKeyAlgorithm:secKeyParameters:completion:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn exchangeKeysWithPublicKey_secKeyAlgorithm_secKeyParameters_completion(
104 &self,
105 public_key: &NSData,
106 algorithm: &SecKeyAlgorithm,
107 parameters: &NSDictionary,
108 handler: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
109 );
110
111 #[cfg(feature = "objc2-security")]
112 /// Checks if the the provided algorithm can be used for performing key exchanges
113 ///
114 /// Parameter `algorithm`: Cryptographic algorithm
115 ///
116 /// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
117 #[unsafe(method(canExchangeKeysUsingSecKeyAlgorithm:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn canExchangeKeysUsingSecKeyAlgorithm(
120 &self,
121 algorithm: &SecKeyAlgorithm,
122 ) -> bool;
123
124 /// Clients cannot create
125 /// `LAPrivateKey`instances directly. They typically obtain them from a
126 /// `LAPersistedRight`instance.
127 #[unsafe(method(new))]
128 #[unsafe(method_family = new)]
129 pub unsafe fn new() -> Retained<Self>;
130
131 /// Clients cannot create
132 /// `LAPrivateKey`instances directly. They typically obtain them from a
133 /// `LAPersistedRight`instance.
134 #[unsafe(method(init))]
135 #[unsafe(method_family = init)]
136 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
137 );
138}