1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-security")]
use objc2_security::*;
use crate::*;
extern_class!(
/// The public part of an asymmetric key pair
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/localauthentication/lapublickey?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct LAPublicKey;
);
extern_conformance!(
unsafe impl NSObjectProtocol for LAPublicKey {}
);
impl LAPublicKey {
extern_methods!(
#[cfg(feature = "block2")]
/// Exports public key bytes.
///
/// Parameter `handler`: Completion handler with the raw bytes of the public key or an error on failure
///
/// # Safety
///
/// `handler` block must be sendable.
#[unsafe(method(exportBytesWithCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn exportBytesWithCompletion(
&self,
handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
);
#[cfg(all(feature = "block2", feature = "objc2-security"))]
/// Encrypts the given data
///
/// Parameter `data`: The data to encrypt.
///
/// Parameter `algorithm`: A
/// `SecKeyAlgorithm`suitable for encrypting with this key –e.g:
/// `kSecKeyAlgorithmECIESEncryptionStandardVariableIVX963SHA256AESGCM`.
///
/// Parameter `handler`: Completion handler with the cipher text or an error on failure.
///
/// # Safety
///
/// `handler` block must be sendable.
#[unsafe(method(encryptData:secKeyAlgorithm:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn encryptData_secKeyAlgorithm_completion(
&self,
data: &NSData,
algorithm: &SecKeyAlgorithm,
handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
);
#[cfg(feature = "objc2-security")]
/// Checks if the the provided algorithm can be used for encryption with the key.
///
/// Parameter `algorithm`: Cryptographic algorithm
///
/// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
#[unsafe(method(canEncryptUsingSecKeyAlgorithm:))]
#[unsafe(method_family = none)]
pub unsafe fn canEncryptUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
#[cfg(all(feature = "block2", feature = "objc2-security"))]
/// Verifies a digital signature for the given data.
///
/// Parameter `signedData`: The signed data.
///
/// Parameter `signature`: The signature of the given data.
///
/// Parameter `algorithm`: One of
/// `SecKeyAlgorithm`suitable for verifying signatures with this key –e.g:
/// `kSecKeyAlgorithmECDSASignatureMessageX962SHA256`
/// Parameter `handler`: Completion handler with the signature of given data or an error on failure.
///
/// # Safety
///
/// `handler` block must be sendable.
#[unsafe(method(verifyData:signature:secKeyAlgorithm:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn verifyData_signature_secKeyAlgorithm_completion(
&self,
signed_data: &NSData,
signature: &NSData,
algorithm: &SecKeyAlgorithm,
handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "objc2-security")]
/// Checks if the the provided algorithm can be used for verifying signatures with the key.
///
/// Parameter `algorithm`: Cryptographic algorithm
///
/// Returns: `YES`in case the key supports the provided algorithm with the specified operation.
#[unsafe(method(canVerifyUsingSecKeyAlgorithm:))]
#[unsafe(method_family = none)]
pub unsafe fn canVerifyUsingSecKeyAlgorithm(&self, algorithm: &SecKeyAlgorithm) -> bool;
/// Clients cannot create
/// `LAPublicKey`instances directly. They can only obtain them from a related
/// `LAPrivateKey`instance
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
/// Clients cannot create
/// `LAPublicKey`instances directly. They can only obtain them from a related
/// `LAPrivateKey`instance
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}