Skip to content

Commit

Permalink
Add SecKeyOperationType and SecKeyIsAlgorithmSupported.
Browse files Browse the repository at this point in the history
  • Loading branch information
sheagcraig authored and kornelski committed Dec 5, 2023
1 parent 3337db6 commit 360e00c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions security-framework-sys/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ use crate::base::SecKeyRef;
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub type SecKeyAlgorithm = CFStringRef;

#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub type SecKeyOperationType = u32;
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub const kSecKeyOperationTypeSign: SecKeyOperationType = 0;
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub const kSecKeyOperationTypeVerify: SecKeyOperationType = 1;
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub const kSecKeyOperationTypeEncrypt: SecKeyOperationType = 2;
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub const kSecKeyOperationTypeDecrypt: SecKeyOperationType = 3;
#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub const kSecKeyOperationTypeKeyExchange: SecKeyOperationType = 4;

extern "C" {
pub fn SecKeyGetTypeID() -> CFTypeID;

Expand Down Expand Up @@ -46,6 +59,13 @@ extern "C" {
signature: CFDataRef,
error: *mut CFErrorRef,
) -> core_foundation_sys::base::Boolean;

#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
pub fn SecKeyIsAlgorithmSupported(
key: SecKeyRef,
operation: SecKeyOperationType,
algorithm: SecKeyAlgorithm,
) -> core_foundation_sys::base::Boolean;
}

#[cfg(any(feature = "OSX_10_12", target_os = "ios"))]
Expand Down

0 comments on commit 360e00c

Please sign in to comment.