Coder Social home page Coder Social logo

kornelski / rust-security-framework Goto Github PK

View Code? Open in Web Editor NEW
230.0 11.0 86.0 2.95 MB

Bindings to the macOS Security.framework

Home Page: https://lib.rs/security-framework

License: Apache License 2.0

Rust 99.24% C 0.03% Swift 0.27% Objective-C 0.04% Shell 0.42%
rust rust-bindings macos keychain

rust-security-framework's Introduction

macOS/iOS Security framework for Rust

Latest Version

Documentation

Bindings to the Apple's Security.framework. Allows use of TLS and Keychain from Rust.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

rust-security-framework's People

Contributors

adunham-stripe avatar alex avatar alexcrichton avatar azdlowry avatar brandonweeks avatar brotskydotcom avatar ctz avatar cyang1 avatar ddeville avatar emanuele-em avatar frewsxcv avatar gezihuzi avatar grahamc avatar greggalloway avatar jrmuizel avatar kali avatar kcking avatar kornelski avatar lashomb avatar lqf96 avatar luben avatar lukasa avatar ragoso avatar scottschroeder avatar sergejjurecko avatar sfackler avatar simlay avatar stepancheg avatar steven-joruk avatar toksdotdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-security-framework's Issues

Authorization Services

I'm currently working on adding support for Authorization Services. Is this something you'd be interested in a PR for?

Just thought I'd add an issue to track it in case someone else was thinking of doing the same.

Please git tag releases

The last release is 2.0.0, but there's no git tag for it.

Tag is helpful to do debugging: to checkout exact version locally and modify it.

Consider removing feature "alpn"

Is there a reason to not enable this feature unconditionally?

Currently even when feature is on, it is not a guarantee that ALPN will actually work. And when feature is off, it just hides some functions, and nothing more.

Could not find keychain_item in security_framework_sys

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.7
BuildVersion:   19H2

$ rustc --version
rustc 1.49.0 (e1884a8e3 2020-12-29)

$ cargo --version
cargo 1.49.0 (d00d64df9 2020-12-05)

$ git clone https://github.com/kornelski/rust-security-framework
$ cd rust-security-framework
$ cargo build --target x86_64-apple-ios

...

Compiling security-framework v2.1.0 (/Users/jenkins/sergeivii-test-a/rust-security-framework/security-framework)
error[E0432]: unresolved import `security_framework_sys::keychain_item`
  --> security-framework/src/item.rs:14:29
   |
14 | use security_framework_sys::keychain_item::SecItemCopyMatching;
   |                             ^^^^^^^^^^^^^ could not find `keychain_item` in `security_framework_sys`

Memory leak on macOS Catalina

See sfackler/rust-native-tls#171, which also contains the test program for the leak. Cargo.lock says:

[[package]]
name = "security-framework"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535"
dependencies = [
 "bitflags",
 "core-foundation",
 "core-foundation-sys",
 "libc",
 "security-framework-sys",
]

[[package]]
name = "security-framework-sys"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405"
dependencies = [
 "core-foundation-sys",
 "libc",
]

Note that I have limited access to macOS machines, and can't run GUI tools such as Instruments.

Two symbols missing in simulator setup

Hello,

SecKeychainGetTypeID and SecAccessGetTypeID are missing at link time when I target the iphone6 simulator. Strangely I don't have the problem when I target an actual iphone6. Do we have another cfg() mixup somewhere ?

undef: _SecKeychainGetTypeID
undef: _SecAccessGetTypeID
Undefined symbols for architecture x86_64:
  "_SecKeychainGetTypeID", referenced from:
      _$LT$security_framework..keychain..SecKeychain$u20$as$u20$core_foundation..base..TCFType$LT$$BP$mut$u20$security_framework_sys..base..OpaqueSecKeychainRef$GT$$GT$::type_id::h0b49430b489586d5 in SnipsSda(security_framework-d4c2fbca6aed6c3a.0.o)
  "_SecAccessGetTypeID", referenced from:
      _$LT$security_framework..access..SecAccess$u20$as$u20$core_foundation..base..TCFType$LT$$BP$mut$u20$security_framework_sys..base..OpaqueSecAccessRef$GT$$GT$::type_id::h5bfb1124c8dad652 in SnipsSda(security_framework-d4c2fbca6aed6c3a.0.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Recent MSRV is 1.34.0. Document? Test?

This may just be an FYI. Close if your prefer.

Looks like as part of #82, released in 0.3.2, this crate started using std::convert::TryFrom which I believe is MSRV 1.34.0:

   Compiling security-framework v0.3.3

error[E0658]: use of unstable library feature 'try_from' (see issue #33417)

  --> /Users/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.3.3/src/trust_settings.rs:13:5

   |

13 | use std::convert::TryFrom;

   |     ^^^^^^^^^^^^^^^^^^^^^

error[E0658]: use of unstable library feature 'try_from' (see issue #33417)

  --> /Users/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.3.3/src/trust_settings.rs:64:15

   |

64 |         match u32::try_from(value).ok() {

   |               ^^^^^^^^^^^^^

I couldn't find any position for what the expected MSRV is here. Not sure if there is any CI for this, etc.

PEM issue on Catalina

Hi
It looks like macos will not load the cert generated by mk-ca-cert.pl
I tried with the macos keychain utility and it refused to load the new ca-bundle.crt. When I converted the PEM to a DER, it loaded. However, my remote app won't accept a DER.
I realize you have no skin in this game, but any insight you have would be appreciated.
I'll also ask on r/rust

"The trust policy was not trusted."

I'm using native-tls with Tokio to set up encrypted IRC connections. When I attempt to connect to my server irc.pdgn.co, I get a TlsError saying "The trust policy was not trusted." This also occurs when I'm trying to connect to chat.freenode.net over TLS. Both servers use Lets Encrypt certificates. I haven't tested with anything that uses another CA (because I don't know of any IRC servers that do).

Here is the full chain in pem format for one of my servers:

-----BEGIN CERTIFICATE-----
MIIFDzCCA/egAwIBAgISBMCp9mv7iTtbgkA8t5uuALq5MA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNzA1MDIyMDEzMDBaFw0x
NzA3MzEyMDEzMDBaMBoxGDAWBgNVBAMTD2NvbHVtYmEucGRnbi5jbzCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAOO14hNklUQyfdedvU3m48WZzEC7c9mu
2j9pKCnZdQsPJ9G6Aa2AfdBqZOoBpOiFPeXlArfjzdMfzRCg3dVJp6eS9CLdwvf/
z0zqOPU7CbTsIP6gvyqAlys//EznJsC1o0NBl1dSYyHFZf3Pg0UJhMliyrVivMa6
0Lr/aCjL8svZi+kWaT+c0hST7h6ulQtcF3v+hjF1iMHBRVwkuaenNsaaZzqjky7X
skSlzV1jseaMMoCo7XoyZGPKgxU29qSzvyPu+hpOwyxqjAQwi346YkOKpSvB8tGm
OAlR4pSQnF6DdmI+/iTfXc69IX6jzFqF/IAIdvervRK3KtKkTBHyVmECAwEAAaOC
Ah0wggIZMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYB
BQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQU/L1Wd+Ol04xJv8BdvqDcC20G
VKYwHwYDVR0jBBgwFoAUqEpqYwR93brm0Tm3pkVl7/Oo7KEwcAYIKwYBBQUHAQEE
ZDBiMC8GCCsGAQUFBzABhiNodHRwOi8vb2NzcC5pbnQteDMubGV0c2VuY3J5cHQu
b3JnLzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgzLmxldHNlbmNyeXB0
Lm9yZy8wJwYDVR0RBCAwHoIPY29sdW1iYS5wZGduLmNvggtpcmMucGRnbi5jbzCB
/gYDVR0gBIH2MIHzMAgGBmeBDAECATCB5gYLKwYBBAGC3xMBAQEwgdYwJgYIKwYB
BQUHAgEWGmh0dHA6Ly9jcHMubGV0c2VuY3J5cHQub3JnMIGrBggrBgEFBQcCAjCB
ngyBm1RoaXMgQ2VydGlmaWNhdGUgbWF5IG9ubHkgYmUgcmVsaWVkIHVwb24gYnkg
UmVseWluZyBQYXJ0aWVzIGFuZCBvbmx5IGluIGFjY29yZGFuY2Ugd2l0aCB0aGUg
Q2VydGlmaWNhdGUgUG9saWN5IGZvdW5kIGF0IGh0dHBzOi8vbGV0c2VuY3J5cHQu
b3JnL3JlcG9zaXRvcnkvMA0GCSqGSIb3DQEBCwUAA4IBAQBDbmlcU53FxJryuWFV
CBOjDTGjoTrgqTNwiwrvaR4McOknTDJdfAsVtCfBIkE3usAJA9vHTlAVq9lO8jdb
JkRmfAHiaZ0wYKyDbNOipV91E3R2oiiC4odUXuy1h1TGrJ9GYQ/nd0L9nRdS/8zI
BG64itXdUlsUvUi3vYzRUHcA1WsJ4ZBWwfBgzafoqzPi//Z0DDTaK3rWcIP0eRIu
zjV69T+UE0U0A6SXaOe99rXp3GCfe0sDLGOc+LgBRfWAN0ODEj/+6vIAR9nmCQ3G
VirY236kv3mOO3/AlVsQn27uLXj/Jid5/DHv5rEwNX/1gc12X306J8AWRfH1+BHA
Q3T5
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow
SjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT
GkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF
q6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8
SMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0
Z8h/pZq4UmEUEz9l6YKHy9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWA
a6xK8xuQSXgvopZPKiAlKQTGdMDQMc2PMTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj
/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQABo4IBfTCCAXkwEgYDVR0T
AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwfwYIKwYBBQUHAQEEczBxMDIG
CCsGAQUFBzABhiZodHRwOi8vaXNyZy50cnVzdGlkLm9jc3AuaWRlbnRydXN0LmNv
bTA7BggrBgEFBQcwAoYvaHR0cDovL2FwcHMuaWRlbnRydXN0LmNvbS9yb290cy9k
c3Ryb290Y2F4My5wN2MwHwYDVR0jBBgwFoAUxKexpHsscfrb4UuQdf/EFWCFiRAw
VAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcC
ARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAz
MDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwu
Y3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsF
AAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo
uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/
wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu
X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG
PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6
KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==
-----END CERTIFICATE-----

Here is the relevant portion of code:

let domain = format!("{}:{}", config.server(), config.port());
let connector = TlsConnector::builder()?.build()?;
let stream = TcpStream::connect(&config.socket_addr(), handle).map_err(|e| {
    let res: error::Error = e.into();
    res
}).and_then(move |socket| {
    connector.connect_async(&domain, socket).map_err(|e| e.into())
}).boxed();

Run tests under sanitizers when they're available

The nightly toolchain had support for compiling with sanitizers enabled up until a recent regression, which will soon be fixed: rust-lang/rust#65241

Once it's resolved it would be good to run the tests using them, I intended to for the authorization PR given that Valgrind is also still broken on macOS, but no luck :(

Odd results when debugging retain counts

I've been doing some testing on PR #17, and I've been getting interesting results when looking at the retain counts of the keychains being created and passed around, so I added some simple logging to the Drop and Clone impl for everything that goes through make_wrapper! to see what the retain counts are at the end of each objects life.

The retain counts I'm seeing when running the crate tests for security-framework itself with no other modifications generally look like this:

test os::macos::secure_transport::test::server_client_builders ... 
cloning SecCertificate<0x7000063d63b8>(inner: 0x7f81c5e57980) with retain count: 1
dropping SecKeychain<0x7000067e5430>(inner: 0x7f81c6803200) with retain count: 5
cloning SecIdentity<0x7000067e59b0>(inner: 0x7f81c5d2b900) with retain count: 1
dropping SecTrust<0x7000063d5fd8>(inner: 0x7f81c5c4e780) with retain count: 2
dropping SecCertificate<0x7000063d63b8>(inner: 0x7f81c5e57980) with retain count: 3
dropping SecCertificate<0x10301e000>(inner: 0x7f81c5e57980) with retain count: 2
dropping SecIdentity<0x7000067e5990>(inner: 0x7f81c5d2b900) with retain count: 2
dropping SecIdentity<0x7000067e59b0>(inner: 0x7f81c5d2b900) with retain count: 1
ok

The SecIdentity looks reasonable, it got cloned once, leading to two SecIdentity's with the same inner ref and a retain count of 2, then both of them got dropped and the retain count should be 0 afterward.

The SecKeychain on the other hand, has no clones and has a retain count of 5.

Is there something else going on here that I'm not seeing by looking at that narrow window of time during Clones and Drops?

Thanks :)

Compile failure after updating to security-framework-sys v0.2.4

I get a myriad of compile errors after running cargo update:

$ cargo outdated
Name                                         Project  Compat   Latest   Kind    Platform
----                                         -------  ------   ------   ----    --------
MacTypes-sys->libc                           0.2.49   Removed  Removed  Normal  ---
core-foundation-sys->libc                    0.2.49   Removed  Removed  Normal  ---
native-tls->security-framework-sys           0.2.3    0.2.4    0.2.4    Normal  cfg(any(target_os = "macos", target_os = "ios"))
security-framework->security-framework-sys   0.2.3    0.2.4    0.2.4    Normal  ---
security-framework-sys->MacTypes-sys         2.1.0    Removed  Removed  Normal  ---
security-framework-sys->core-foundation-sys  0.5.1    0.6.2    0.6.2    Normal  ---
$
$ cargo update -p security-framework-sys
    Updating crates.io index
    Removing MacTypes-sys v2.1.0
      Adding core-foundation-sys v0.6.2
    Updating security-framework-sys v0.2.3 -> v0.2.4
Compile errors

$ cargo build
   Compiling core-foundation-sys v0.6.2
   Compiling security-framework-sys v0.2.4
   Compiling security-framework v0.2.2
error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/base.rs:49:55
   |
49 |                 Some(CFString::wrap_under_create_rule(s).to_string())
   |                                                       ^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/base.rs:49:55
   |
49 |                 Some(CFString::wrap_under_create_rule(s).to_string())
   |                                                       ^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/certificate.rs:36:67
   |
36 |                 SecCertificateCreateWithData(kCFAllocatorDefault, der_data.as_concrete_TypeRef());
   |                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::data::__CFData`, found struct `core_foundation::data::__CFData`
   |
   = note: expected type `*const core_foundation_sys::data::__CFData`
              found type `*const core_foundation::data::__CFData`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/certificate.rs:36:67
   |
36 |                 SecCertificateCreateWithData(kCFAllocatorDefault, der_data.as_concrete_TypeRef());
   |                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/certificate.rs:49:44
   |
49 |             CFData::wrap_under_create_rule(der_data).to_vec()
   |                                            ^^^^^^^^ expected struct `core_foundation::data::__CFData`, found struct `core_foundation_sys::data::__CFData`
   |
   = note: expected type `*const core_foundation::data::__CFData`
              found type `*const core_foundation_sys::data::__CFData`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/certificate.rs:49:44
   |
49 |             CFData::wrap_under_create_rule(der_data).to_vec()
   |                                            ^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/certificate.rs:57:46
   |
57 |             CFString::wrap_under_create_rule(summary).to_string()
   |                                              ^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/certificate.rs:57:46
   |
57 |             CFString::wrap_under_create_rule(summary).to_string()
   |                                              ^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:100:51
    |
100 |                     CFString::wrap_under_get_rule(kSecImportExportPassphrase),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:100:51
    |
100 |                     CFString::wrap_under_get_rule(kSecImportExportPassphrase),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:111:17
    |
111 |                 pkcs12_data.as_concrete_TypeRef(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::data::__CFData`, found struct `core_foundation::data::__CFData`
    |
    = note: expected type `*const core_foundation_sys::data::__CFData`
               found type `*const core_foundation::data::__CFData`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:111:17
    |
111 |                 pkcs12_data.as_concrete_TypeRef(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:112:17
    |
112 |                 options.as_concrete_TypeRef(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::dictionary::__CFDictionary`, found struct `core_foundation::dictionary::__CFDictionary`
    |
    = note: expected type `*const core_foundation_sys::dictionary::__CFDictionary`
               found type `*const core_foundation::dictionary::__CFDictionary`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:112:17
    |
112 |                 options.as_concrete_TypeRef(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:115:77
    |
115 |             let raw_items = CFArray::<CFDictionary>::wrap_under_create_rule(raw_items);
    |                                                                             ^^^^^^^^^ expected struct `core_foundation::array::__CFArray`, found struct `core_foundation_sys::array::__CFArray`
    |
    = note: expected type `*const core_foundation::array::__CFArray`
               found type `*const core_foundation_sys::array::__CFArray`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:115:77
    |
115 |             let raw_items = CFArray::<CFDictionary>::wrap_under_create_rule(raw_items);
    |                                                                             ^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:160:51
    |
160 |                     CFString::wrap_under_get_rule(kSecImportExportKeychain),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:160:51
    |
160 |                     CFString::wrap_under_get_rule(kSecImportExportKeychain),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:167:51
    |
167 |                     CFString::wrap_under_get_rule(kSecImportExportAccess),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/import_export.rs:167:51
    |
167 |                     CFString::wrap_under_get_rule(kSecImportExportAccess),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:30:28
   |
30 |         unsafe { ItemClass(kSecClassGenericPassword) }
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:30:28
   |
30 |         unsafe { ItemClass(kSecClassGenericPassword) }
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:35:28
   |
35 |         unsafe { ItemClass(kSecClassInternetPassword) }
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:35:28
   |
35 |         unsafe { ItemClass(kSecClassInternetPassword) }
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:40:28
   |
40 |         unsafe { ItemClass(kSecClassCertificate) }
   |                            ^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:40:28
   |
40 |         unsafe { ItemClass(kSecClassCertificate) }
   |                            ^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:45:28
   |
45 |         unsafe { ItemClass(kSecClassKey) }
   |                            ^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:45:28
   |
45 |         unsafe { ItemClass(kSecClassKey) }
   |                            ^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:50:28
   |
50 |         unsafe { ItemClass(kSecClassIdentity) }
   |                            ^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:50:28
   |
50 |         unsafe { ItemClass(kSecClassIdentity) }
   |                            ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:128:51
    |
128 |                     CFString::wrap_under_get_rule(kSecMatchSearchList),
    |                                                   ^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:128:51
    |
128 |                     CFString::wrap_under_get_rule(kSecMatchSearchList),
    |                                                   ^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:134:60
    |
134 |                 params.push((CFString::wrap_under_get_rule(kSecClass), class.to_value()));
    |                                                            ^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:134:60
    |
134 |                 params.push((CFString::wrap_under_get_rule(kSecClass), class.to_value()));
    |                                                            ^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:139:51
    |
139 |                     CFString::wrap_under_get_rule(kSecReturnRef),
    |                                                   ^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:139:51
    |
139 |                     CFString::wrap_under_get_rule(kSecReturnRef),
    |                                                   ^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:146:51
    |
146 |                     CFString::wrap_under_get_rule(kSecMatchLimit),
    |                                                   ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:146:51
    |
146 |                     CFString::wrap_under_get_rule(kSecMatchLimit),
    |                                                   ^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:153:51
    |
153 |                     CFString::wrap_under_get_rule(kSecAttrLabel),
    |                                                   ^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:153:51
    |
153 |                     CFString::wrap_under_get_rule(kSecAttrLabel),
    |                                                   ^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:161:37
    |
161 |             cvt(SecItemCopyMatching(params.as_concrete_TypeRef(), &mut ret))?;
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::dictionary::__CFDictionary`, found struct `core_foundation::dictionary::__CFDictionary`
    |
    = note: expected type `*const core_foundation_sys::dictionary::__CFDictionary`
               found type `*const core_foundation::dictionary::__CFDictionary`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/item.rs:161:37
    |
161 |             cvt(SecItemCopyMatching(params.as_concrete_TypeRef(), &mut ret))?;
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:42:49
   |
42 |             Ok(CFString::wrap_under_create_rule(string).to_string())
   |                                                 ^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:42:49
   |
42 |             Ok(CFString::wrap_under_create_rule(string).to_string())
   |                                                 ^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:74:83
   |
74 |             let dictionary = SecCertificateCopyValues(self.as_concrete_TypeRef(), keys, &mut error);
   |                                                                                   ^^^^ expected struct `core_foundation_sys::array::__CFArray`, found struct `core_foundation::array::__CFArray`
   |
   = note: expected type `*const core_foundation_sys::array::__CFArray`
              found type `*const core_foundation::array::__CFArray`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:74:83
   |
74 |             let dictionary = SecCertificateCopyValues(self.as_concrete_TypeRef(), keys, &mut error);
   |                                                                                   ^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:78:21
   |
78 |                     dictionary,
   |                     ^^^^^^^^^^ expected struct `core_foundation::dictionary::__CFDictionary`, found struct `core_foundation_sys::dictionary::__CFDictionary`
   |
   = note: expected type `*const core_foundation::dictionary::__CFDictionary`
              found type `*const core_foundation_sys::dictionary::__CFDictionary`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:78:21
   |
78 |                     dictionary,
   |                     ^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:81:53
   |
81 |                 Err(CFError::wrap_under_create_rule(error))
   |                                                     ^^^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
   |
   = note: expected type `*mut core_foundation::error::__CFError`
              found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:81:53
   |
81 |                 Err(CFError::wrap_under_create_rule(error))
   |                                                     ^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:122:55
    |
122 |             if type_ == CFString::wrap_under_get_rule(kSecPropertyTypeSection) {
    |                                                       ^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:122:55
    |
122 |             if type_ == CFString::wrap_under_get_rule(kSecPropertyTypeSection) {
    |                                                       ^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:126:62
    |
126 |             } else if type_ == CFString::wrap_under_get_rule(kSecPropertyTypeString) {
    |                                                              ^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate.rs:126:62
    |
126 |             } else if type_ == CFString::wrap_under_get_rule(kSecPropertyTypeString) {
    |                                                              ^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate_oids.rs:13:33
   |
13 |         unsafe { CertificateOid(kSecOIDX509V1SignatureAlgorithm) }
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/certificate_oids.rs:13:33
   |
13 |         unsafe { CertificateOid(kSecOIDX509V1SignatureAlgorithm) }
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:23:29
   |
23 |         unsafe { DigestType(kSecDigestHMACMD5) }
   |                             ^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:23:29
   |
23 |         unsafe { DigestType(kSecDigestHMACMD5) }
   |                             ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:27:29
   |
27 |         unsafe { DigestType(kSecDigestHMACSHA1) }
   |                             ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:27:29
   |
27 |         unsafe { DigestType(kSecDigestHMACSHA1) }
   |                             ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:31:29
   |
31 |         unsafe { DigestType(kSecDigestHMACSHA2) }
   |                             ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:31:29
   |
31 |         unsafe { DigestType(kSecDigestHMACSHA2) }
   |                             ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:35:29
   |
35 |         unsafe { DigestType(kSecDigestMD2) }
   |                             ^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:35:29
   |
35 |         unsafe { DigestType(kSecDigestMD2) }
   |                             ^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:39:29
   |
39 |         unsafe { DigestType(kSecDigestMD4) }
   |                             ^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:39:29
   |
39 |         unsafe { DigestType(kSecDigestMD4) }
   |                             ^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:43:29
   |
43 |         unsafe { DigestType(kSecDigestMD5) }
   |                             ^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:43:29
   |
43 |         unsafe { DigestType(kSecDigestMD5) }
   |                             ^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:47:29
   |
47 |         unsafe { DigestType(kSecDigestSHA1) }
   |                             ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:47:29
   |
47 |         unsafe { DigestType(kSecDigestSHA1) }
   |                             ^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:51:29
   |
51 |         unsafe { DigestType(kSecDigestSHA2) }
   |                             ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:51:29
   |
51 |         unsafe { DigestType(kSecDigestSHA2) }
   |                             ^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:120:60
    |
120 |                 return Err(CFError::wrap_under_create_rule(error));
    |                                                            ^^^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
    |
    = note: expected type `*mut core_foundation::error::__CFError`
               found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:120:60
    |
120 |                 return Err(CFError::wrap_under_create_rule(error));
    |                                                            ^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:125:57
    |
125 |                 let key = CFString::wrap_under_get_rule(kSecDigestHMACKeyAttribute);
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:125:57
    |
125 |                 let key = CFString::wrap_under_get_rule(kSecDigestHMACKeyAttribute);
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:129:53
    |
129 |             let key = CFString::wrap_under_get_rule(kSecTransformInputAttributeName);
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/digest_transform.rs:129:53
    |
129 |             let key = CFString::wrap_under_get_rule(kSecTransformInputAttributeName);
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:23:26
   |
23 |         unsafe { Padding(kSecPaddingNoneKey) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:23:26
   |
23 |         unsafe { Padding(kSecPaddingNoneKey) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:28:26
   |
28 |         unsafe { Padding(kSecPaddingPKCS1Key) }
   |                          ^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:28:26
   |
28 |         unsafe { Padding(kSecPaddingPKCS1Key) }
   |                          ^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:33:26
   |
33 |         unsafe { Padding(kSecPaddingPKCS5Key) }
   |                          ^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:33:26
   |
33 |         unsafe { Padding(kSecPaddingPKCS5Key) }
   |                          ^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:38:26
   |
38 |         unsafe { Padding(kSecPaddingPKCS7Key) }
   |                          ^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:38:26
   |
38 |         unsafe { Padding(kSecPaddingPKCS7Key) }
   |                          ^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:43:26
   |
43 |         unsafe { Padding(kSecPaddingOAEPKey) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:43:26
   |
43 |         unsafe { Padding(kSecPaddingOAEPKey) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:60:23
   |
60 |         unsafe { Mode(kSecModeNoneKey) }
   |                       ^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:60:23
   |
60 |         unsafe { Mode(kSecModeNoneKey) }
   |                       ^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:64:23
   |
64 |         unsafe { Mode(kSecModeECBKey) }
   |                       ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:64:23
   |
64 |         unsafe { Mode(kSecModeECBKey) }
   |                       ^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:68:23
   |
68 |         unsafe { Mode(kSecModeCBCKey) }
   |                       ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:68:23
   |
68 |         unsafe { Mode(kSecModeCBCKey) }
   |                       ^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:72:23
   |
72 |         unsafe { Mode(kSecModeCFBKey) }
   |                       ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:72:23
   |
72 |         unsafe { Mode(kSecModeCFBKey) }
   |                       ^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:76:23
   |
76 |         unsafe { Mode(kSecModeOFBKey) }
   |                       ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:76:23
   |
76 |         unsafe { Mode(kSecModeOFBKey) }
   |                       ^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:128:60
    |
128 |                 return Err(CFError::wrap_under_create_rule(error));
    |                                                            ^^^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
    |
    = note: expected type `*mut core_foundation::error::__CFError`
               found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:128:60
    |
128 |                 return Err(CFError::wrap_under_create_rule(error));
    |                                                            ^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:142:60
    |
142 |                 return Err(CFError::wrap_under_create_rule(error));
    |                                                            ^^^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
    |
    = note: expected type `*mut core_foundation::error::__CFError`
               found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:142:60
    |
142 |                 return Err(CFError::wrap_under_create_rule(error));
    |                                                            ^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:153:57
    |
153 |                 let key = CFString::wrap_under_get_rule(kSecPaddingKey);
    |                                                         ^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:153:57
    |
153 |                 let key = CFString::wrap_under_get_rule(kSecPaddingKey);
    |                                                         ^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:158:57
    |
158 |                 let key = CFString::wrap_under_get_rule(kSecEncryptionMode);
    |                                                         ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:158:57
    |
158 |                 let key = CFString::wrap_under_get_rule(kSecEncryptionMode);
    |                                                         ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:163:57
    |
163 |                 let key = CFString::wrap_under_get_rule(kSecIVKey);
    |                                                         ^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:163:57
    |
163 |                 let key = CFString::wrap_under_get_rule(kSecIVKey);
    |                                                         ^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:167:53
    |
167 |             let key = CFString::wrap_under_get_rule(kSecTransformInputAttributeName);
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
    |
    = note: expected type `*const core_foundation::string::__CFString`
               found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/encrypt_transform.rs:167:53
    |
167 |             let key = CFString::wrap_under_get_rule(kSecTransformInputAttributeName);
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:156:37
    |
156 |             key_params.alertTitle = alert_title.as_concrete_TypeRef();
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::string::__CFString`, found struct `core_foundation::string::__CFString`
    |
    = note: expected type `*const core_foundation_sys::string::__CFString`
               found type `*const core_foundation::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:156:37
    |
156 |             key_params.alertTitle = alert_title.as_concrete_TypeRef();
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:160:38
    |
160 |             key_params.alertPrompt = alert_prompt.as_concrete_TypeRef();
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::string::__CFString`, found struct `core_foundation::string::__CFString`
    |
    = note: expected type `*const core_foundation_sys::string::__CFString`
               found type `*const core_foundation::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:160:38
    |
160 |             key_params.alertPrompt = alert_prompt.as_concrete_TypeRef();
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:176:17
    |
176 |                 data,
    |                 ^^^^ expected struct `core_foundation_sys::data::__CFData`, found struct `core_foundation::data::__CFData`
    |
    = note: expected type `*const core_foundation_sys::data::__CFData`
               found type `*const core_foundation::data::__CFData`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:176:17
    |
176 |                 data,
    |                 ^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:177:17
    |
177 |                 filename,
    |                 ^^^^^^^^ expected struct `core_foundation_sys::string::__CFString`, found struct `core_foundation::string::__CFString`
    |
    = note: expected type `*const core_foundation_sys::string::__CFString`
               found type `*const core_foundation::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:177:17
    |
177 |                 filename,
    |                 ^^^^^^^^

error[E0606]: casting `&mut *const core_foundation::array::__CFArray` as `*mut *const core_foundation_sys::array::__CFArray` is invalid
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/import_export.rs:170:24
    |
170 |             Some(_) => &mut raw_items as *mut _,
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:19:26
   |
19 |         unsafe { KeyType(kSecAttrKeyTypeRSA) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:19:26
   |
19 |         unsafe { KeyType(kSecAttrKeyTypeRSA) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:23:26
   |
23 |         unsafe { KeyType(kSecAttrKeyTypeDES) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:23:26
   |
23 |         unsafe { KeyType(kSecAttrKeyTypeDES) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:27:26
   |
27 |         unsafe { KeyType(kSecAttrKeyTypeAES) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:27:26
   |
27 |         unsafe { KeyType(kSecAttrKeyTypeAES) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:31:26
   |
31 |         unsafe { KeyType(kSecAttrKeyTypeDES) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:31:26
   |
31 |         unsafe { KeyType(kSecAttrKeyTypeDES) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:35:26
   |
35 |         unsafe { KeyType(kSecAttrKeyType3DES) }
   |                          ^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:35:26
   |
35 |         unsafe { KeyType(kSecAttrKeyType3DES) }
   |                          ^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:39:26
   |
39 |         unsafe { KeyType(kSecAttrKeyTypeRC4) }
   |                          ^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:39:26
   |
39 |         unsafe { KeyType(kSecAttrKeyTypeRC4) }
   |                          ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:43:26
   |
43 |         unsafe { KeyType(kSecAttrKeyTypeCAST) }
   |                          ^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/item.rs:43:26
   |
43 |         unsafe { KeyType(kSecAttrKeyTypeCAST) }
   |                          ^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:23:53
   |
23 |             let key = CFString::wrap_under_get_rule(kSecAttrKeyType);
   |                                                     ^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |
   = note: expected type `*const core_foundation::string::__CFString`
              found type `*const core_foundation_sys::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:23:53
   |
23 |             let key = CFString::wrap_under_get_rule(kSecAttrKeyType);
   |                                                     ^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:28:17
   |
28 |                 dict.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::dictionary::__CFDictionary`, found struct `core_foundation::dictionary::__CFDictionary`
   |
   = note: expected type `*const core_foundation_sys::dictionary::__CFDictionary`
              found type `*const core_foundation::dictionary::__CFDictionary`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:28:17
   |
28 |                 dict.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:29:17
   |
29 |                 key_data.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::data::__CFData`, found struct `core_foundation::data::__CFData`
   |
   = note: expected type `*const core_foundation_sys::data::__CFData`
              found type `*const core_foundation::data::__CFData`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:29:17
   |
29 |                 key_data.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:33:53
   |
33 |                 Err(CFError::wrap_under_create_rule(err))
   |                                                     ^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
   |
   = note: expected type `*mut core_foundation::error::__CFError`
              found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/key.rs:33:53
   |
33 |                 Err(CFError::wrap_under_create_rule(err))
   |                                                     ^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/secure_transport.rs:151:79
    |
151 |                 let certs = CFArray::<SecCertificate>::wrap_under_create_rule(raw_certs)
    |                                                                               ^^^^^^^^^ expected struct `core_foundation::array::__CFArray`, found struct `core_foundation_sys::array::__CFArray`
    |
    = note: expected type `*const core_foundation::array::__CFArray`
               found type `*const core_foundation_sys::array::__CFArray`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/secure_transport.rs:151:79
    |
151 |                 let certs = CFArray::<SecCertificate>::wrap_under_create_rule(raw_certs)
    |                                                                               ^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/transform.rs:28:17
   |
28 |                 key.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::string::__CFString`, found struct `core_foundation::string::__CFString`
   |
   = note: expected type `*const core_foundation_sys::string::__CFString`
              found type `*const core_foundation::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/transform.rs:28:17
   |
28 |                 key.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/transform.rs:33:60
   |
33 |                 return Err(CFError::wrap_under_create_rule(error));
   |                                                            ^^^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
   |
   = note: expected type `*mut core_foundation::error::__CFError`
              found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/transform.rs:33:60
   |
33 |                 return Err(CFError::wrap_under_create_rule(error));
   |                                                            ^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/transform.rs:48:60
   |
48 |                 return Err(CFError::wrap_under_create_rule(error));
   |                                                            ^^^^^ expected struct `core_foundation::error::__CFError`, found struct `core_foundation_sys::error::__CFError`
   |
   = note: expected type `*mut core_foundation::error::__CFError`
              found type `*mut core_foundation_sys::error::__CFError`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/os/macos/transform.rs:48:60
   |
48 |                 return Err(CFError::wrap_under_create_rule(error));
   |                                                            ^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/policy.rs:39:61
   |
39 |             let policy = SecPolicyCreateSSL(is_server as _, hostname);
   |                                                             ^^^^^^^^ expected struct `core_foundation_sys::string::__CFString`, found struct `core_foundation::string::__CFString`
   |
   = note: expected type `*const core_foundation_sys::string::__CFString`
              found type `*const core_foundation::string::__CFString`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/policy.rs:39:61
   |
39 |             let policy = SecPolicyCreateSSL(is_server as _, hostname);
   |                                                             ^^^^^^^^

error[E0308]: mismatched types
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/secure_transport.rs:527:48
    |
527 |         unsafe { cvt(SSLSetCertificate(self.0, certs.as_concrete_TypeRef())) }
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::array::__CFArray`, found struct `core_foundation::array::__CFArray`
    |
    = note: expected type `*const core_foundation_sys::array::__CFArray`
               found type `*const core_foundation::array::__CFArray`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
   --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/secure_transport.rs:527:48
    |
527 |         unsafe { cvt(SSLSetCertificate(self.0, certs.as_concrete_TypeRef())) }
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/trust.rs:89:17
   |
89 |                 certs.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation_sys::array::__CFArray`, found struct `core_foundation::array::__CFArray`
   |
   = note: expected type `*const core_foundation_sys::array::__CFArray`
              found type `*const core_foundation::array::__CFArray`
note: Perhaps two different versions of crate `core_foundation_sys` are being used?
  --> /Users/MyUser/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.2.2/src/trust.rs:89:17
   |
89 |                 certs.as_concrete_TypeRef(),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 78 previous errors

Some errors occurred: E0308, E0606.
For more information about an error, try `rustc --explain E0308`.
error: Could not compile `security-framework`.

To learn more, run the command again with --verbose.

Since the compiler suggests that two different versions of crate `core_foundation_sys` are being used, here's the relevant part of `cargo tree`:
โ”œโ”€โ”€ hyper-tls v0.3.1
โ”‚   โ”œโ”€โ”€ bytes v0.4.11 (*)
โ”‚   โ”œโ”€โ”€ futures v0.1.25 (*)
โ”‚   โ”œโ”€โ”€ hyper v0.12.25 (*)
โ”‚   โ”œโ”€โ”€ native-tls v0.2.2
โ”‚   โ”‚   โ”œโ”€โ”€ lazy_static v1.3.0 (*)
โ”‚   โ”‚   โ”œโ”€โ”€ libc v0.2.49 (*)
โ”‚   โ”‚   โ”œโ”€โ”€ security-framework v0.2.2
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ core-foundation v0.5.1
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ core-foundation-sys v0.5.1
โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ libc v0.2.49 (*)
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ libc v0.2.49 (*)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ core-foundation-sys v0.5.1 (*)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ libc v0.2.49 (*)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ security-framework-sys v0.2.4
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ core-foundation-sys v0.6.2
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ libc v0.2.49 (*)
โ”‚   โ”‚   โ”œโ”€โ”€ security-framework-sys v0.2.4 (*)
โ”‚   โ”‚   โ””โ”€โ”€ tempfile v3.0.7
โ”‚   โ”‚       โ”œโ”€โ”€ cfg-if v0.1.6 (*)
โ”‚   โ”‚       โ”œโ”€โ”€ libc v0.2.49 (*)
โ”‚   โ”‚       โ”œโ”€โ”€ rand v0.6.5 (*)
โ”‚   โ”‚       โ””โ”€โ”€ remove_dir_all v0.5.1
โ”‚   โ””โ”€โ”€ tokio-io v0.1.12 (*)

Any idea what went wrong?

Cipher configuration test fails on iOS

    thread 'secure_transport::test::cipher_configuration' panicked at 'assertion failed: `(left == right)` (left: `[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256]`, right: `[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_NULL_WITH_NULL_NULL, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_NULL_WITH_NULL_NULL, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_NULL_WITH_NULL_NULL, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_NULL_WITH_NULL_NULL]`)', security-framework/src/secure_transport.rs:1120
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Error: "peer cert is valid, or was ignored if verification disabled"

I get the following error when trying to talk to a SSO solution.

 Hyper(
        Error {
            kind: Io,
            cause: Custom {
                kind: Other,
                error: Error {
                    code: -9841,
                    message: "peer cert is valid, or was ignored if verification disabled"
                }
            }
        }
    )

The same code works on linux fine. When on linux, rusttls uses openssl.

There was some chat about the issue in irc https://mozilla.logbot.info/rust/20190213. We think its because of renegotiation.

Thanks for sharing this library!

subjectPublicKeyInfo and pinning

I have basic pinning implementation imported from TrustKit in mio_httpc. What is required is exposing subjectPublicKeyInfo from a certificate.

https://github.com/SergejJurecko/mio_httpc/blob/master/src/tls_api/apple.rs
Imported from:
https://github.com/datatheorem/TrustKit/blob/master/TrustKit/Pinning/TSKSPKIHashCache.m

I have been working on making this available in rust-native-tls. I'm not sure where it would be correct to have this implementation, native-tls or here. It goes further then simply wrapping over SecurityFramework API, but it is something that might be useful for someone else other than native-tls.

Would you accept a PR that would expose the pubkey (probably better named) function in SecCertificate like I have in mio_httpc?

OS X 10.10 not passing `try_authenticate_no_cert` test

#5

test os::macos::secure_transport::test::try_authenticate_no_cert ... thread '<unnamed>' panicked at 'Failure(Error { code: -25304, message: "The specified item is no longer valid. It may have been deleted from the keychain." })', security-framework/src/os/macos/secure_transport.rs:399
FAILED

SecCertificateCopyPublicKey broken with aarch64-apple-darwin

This isn't technically an issue with this crate, however I thought I file it lest anyone runs into it or knows how to troubleshoot further.

// OK
// $ cargo run --target x86_64-apple-darwin
//
// FAIL
// $ cargo run --target aarch64-apple-darwin
use core_foundation::base::*;
use core_foundation::data::*;
use std::ptr;

pub enum OpaqueSecCertificateRef {}
pub type SecCertificateRef = *mut OpaqueSecCertificateRef;

pub enum OpaqueSecKeyRef {}
pub type SecKeyRef = *mut OpaqueSecKeyRef;

#[link(name = "Security", kind = "framework")]
extern "C" {
    pub fn SecCertificateCreateWithData(
        allocator: CFAllocatorRef,
        data: CFDataRef,
    ) -> SecCertificateRef;
    pub fn SecCertificateCopyPublicKey(
        certificate: SecCertificateRef,
        key: *mut SecKeyRef,
    ) -> OSStatus;
}

fn main() {
    let der_data = CFData::from_buffer(include_bytes!("../server.der"));
    let certificate = unsafe {
        SecCertificateCreateWithData(kCFAllocatorDefault, der_data.as_concrete_TypeRef())
    };
    let mut public_key = ptr::null_mut();
    let status;
    status = unsafe { SecCertificateCopyPublicKey(certificate, &mut public_key) };
    assert_eq!(0, status);
}

Crate: https://github.com/brandonweeks/repro

Steps to reproduce:

  • git clone https://github.com/brandonweeks/repro
  • cargo test --aarch64-apple-darwin on a Apple M1 device

Expected results: SecCertificateCopyPublicKey returns 0.

Actual results: SecCertificateCopyPublicKey returns random garbage that never corresponds to a valid OSStatus value.

This does not reproduce when with cargo test --target x86_64-apple-darwin. I was not able to reproduce using Swift to call the same methods.

docs out of date?

The docs link in the readme doesn't contain the password support. Is it out of date?

Pkcs12ImportOptions::import panics if optional items are missing from pkcs12 file

If any of the items returned from SecPKCS12Import don't include all of kSecImportItemLabel, kSecImportItemKeyID, kSecImportItemTrust, kSecImportItemCertChain, and kSecImportItemIdentity Pkcs12ImportOptions::import will panic with a message such as:

"No entry found for key 0x1ab4c9fd0"

Because of this we can't open pkcs12 file created using openssl. (Other might work)

I believe not all of these keys are required.

Next crates.io release

Any plans for this? I'm interested in a published version containing the changes introduced in #82

Thanks!

write() should not return the error from write_func()

First of all thanks a lot for this lib, helps a lot writing stuff for apple ecosystem.

As far as I understand from apple documentation, SSLWrite() will call SSLWriteFunc(), but if there is any kind of error returned by SSLWriteFunc(), SSLWrite() itself will return an error of its own, ie there is no responsibility the coder has to "save" the error returned by SSLWriteFunc() and then check that after calling SSLWrite() etc.. In fact, doing that might be erroneous - consider this example.

  1. We called SSLWrite(), SSLWriteFunc() might have returned errSslWouldBlock, but SSLWrite() itself succeeded because SSL lib is gonna buffer up the data we provide (and encrypt it and call SSLWriteFunc() on the encrypted data) - so the library has now "cached" an error errSslWouldBlock in conn.err
  2. Later again we call SSLWrite(), this time just as an example say there was some error and the API returned errSSLPeerCertExpired
  3. Now write() will go and check conn.err and will find errSslWouldBlock and that is what the caller to write() gets as an error, which is incorrect

So in summary, IMO there is no need to cache conn.err and return it - unless there was a reason for it, which ill be curious to know

security-framework can't target osx <10.4 due SecTrustEvaluateWithError

Hi:
Since the inclusion of SecTrustEvaluateWithError in 2.1.0, security-framework can't be built on macosx <10.4.
Some of those versions still have an usage share https://www.statista.com/statistics/944559/worldwide-macos-version-market-share/

My personal scenario is that I'm using nix and they use MACOSX_DEPLOYMENT_TARGET=10.12, and this would prevent the use of some packages on macosx.

Unfortunately, I'm not familiar enough with Rust to create a PR.

Calling it 1.0

The interface of the library has been stable for over a year. I don't see a need to do any major changes. Would it be fine to release it as 1.0?

Is there some semver-breaking tweak that you'd like to do before it's called final?

Add an option to support TLS session ticket resumption

From some manual testing (by connecting to a local server run with openssl s_server -key key.pem -cert cert.pem -accept 44330 -tlsextdebug -www -state), it looks like there are two requirements here:

  • Call either SSLSetSessionTicketsEnabled or SSLSetSessionOption with kSSLSessionOptionEnableSessionTickets, which will cause the client to send the SessionTicket extension in its initial ClientHello.
  • Call SSLSetPeerID with something that uniquely identifies the remote (maybe domain + port?).
    Both of these are required, as with just the first, the client will just send an empty SessionTicket extension in its ClientHello every time. It seems like setting a peer ID is required so that Security Framework knows what to key the session ticket against.

In the openssl s_server output, a normal TLS handshake looks like:

SSL_accept:before/accept initialization
TLS client extension "session ticket" (id=35), len=0
...
SSL_accept:SSLv3 read client hello A
SSL_accept:SSLv3 write server hello A
SSL_accept:SSLv3 write certificate A
SSL_accept:SSLv3 write key exchange A
SSL_accept:SSLv3 write server done A
SSL_accept:SSLv3 flush data
SSL_accept:SSLv3 read client certificate A
SSL_accept:SSLv3 read client key exchange A
SSL_accept:SSLv3 read certificate verify A
SSL_accept:SSLv3 read finished A
SSL_accept:SSLv3 write session ticket A
SSL_accept:SSLv3 write change cipher spec A
SSL_accept:SSLv3 write finished A
SSL_accept:SSLv3 flush data

and a handshake with TLS session ticket resumption looks like:

SSL_accept:before/accept initialization
TLS client extension "session ticket" (id=35), len=176
...
SSL_accept:SSLv3 read client hello A
SSL_accept:SSLv3 write server hello A
SSL_accept:SSLv3 write change cipher spec A
SSL_accept:SSLv3 write finished A
SSL_accept:SSLv3 flush data
SSL_accept:SSLv3 read finished A

dlsym.rs is missing a libc dependency

Trying to use this crate with either alpn or session-tickets and not specifying OSX_10_13 results in:

error[E0432]: unresolved import `libc`
 --> security-framework-0.4.2-alpha.1/src/dlsym.rs:8:5
  |
8 | use libc;
  |     ^^^^ no `libc` in the root

v0.4.4 warning for use of deprecated item

warning: use of deprecated item 'imp::security_framework::import_export::Pkcs12ImportOptions::keychain': Replaced by `os::macos::import_export::Pkcs12ImportOptionsExt::keychain`
   --> src/imp/security_framework.rs:137:14
    |
137 |             .keychain(keychain)
    |              ^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated item 'imp::security_framework::import_export::Pkcs12ImportOptions::keychain': Replaced by `os::macos::import_export::Pkcs12ImportOptionsExt::keychain`
   --> src/imp/security_framework.rs:137:14
    |
137 |             .keychain(keychain)
    |              ^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

This is the cause of CI failure in: sfackler/rust-native-tls#157 .

i686 mismatched types

Getting an issue on travis, compiling for i686-apple-darwin

error[E0308]: mismatched types

   --> /Users/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/security-framework-0.1.15/src/trust.rs:124:69

    |

124 |             let certificate = SecTrustGetCertificateAtIndex(self.0, ix);

    |                                                                     ^^ expected i32, found i64

Use SecTrustEvaluateWithError

Current implementation of the crate uses SecTrustEvaluate which returns The certificate was not trusted which does not help much understanding what's wrong.

Documentation of SecTrustEvaluate suggests using SecTrustEvaluateWithError function, which (I suspect) provides more detailed error.

THIRD_PARTY License

WRT: APPLE PUBLIC SOURCE LICENSE

The license states, "This project contains documentation adapted from Apple Inc.'s Security Framework".

What documentation necessitates this license? I was hoping to use this in a project but this license is an issue for us.

New Release

Hey,
When you get a chance, think you could review PRs #34, #35, and then cut a release? I have some rust-native-tls work that depends on master and the outstanding PRs, and then some hyper-native-tls stuff on top of that so it'd be nice to clean up my local replaces a bit :)

Let me know if any of the open issues are blockers to a new release, and I'd be glad to help with them.

APSL license file

I noticed Cargo.toml states the license of security-framework as MIT/Apache-2.0, but the repo also contains an APSL file and it's unclear on which files it applies. Should the license be changed to APSL, does it apply to individual files or can it be removed?

This is related to debian packaging, which considers APSL non-free, but needs to be uploaded anyway due to rust-lang/cargo#5896.

Thanks

`Sync` and/or `Send` not implemented for various types

I'm getting the following error in a project of mine:

src/main.rs:132:9: 132:22 note: `*mut security_framework_sys::base::OpaqueSecIdentityRef` cannot be shared between threads safely
src/main.rs:132:9: 132:22 note: required because it appears within the type `security_framework::identity::SecIdentity`
src/main.rs:132:9: 132:22 note: required because it appears within the type `Config`

I'm trying to fetch the identity from the keychain once, and then save it / pass it around to various threads that need it. If Security.framework supports it, could you add the appropriate bounds?

crash on MacOS 11.4 using `rustls_native_certs::rustls::load_native_certs`

Hi, using the rustls library in my project for the ISRG, I observe the crash listed below.

The maintainer of rustls, @djc, asked me to open an issue here. Note that I am not a Rust expert, but whatever information I can provide, just let me know what you need.

Thanks for your help.

The code calling is found at: https://github.com/rustls/rustls-native-certs/blob/main/src/macos.rs#L11

The Cargo.locksection says:

[[package]]
name = "security-framework"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467"
dependencies = [
 "bitflags",
 "core-foundation",
 "core-foundation-sys",
 "libc",
 "security-framework-sys",
]

[[package]]
name = "security-framework-sys"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284"
dependencies = [
 "core-foundation-sys",
 "libc",
]

The stacktrace of the crash is:

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000110
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x110:
--> 
    __TEXT                      104fb1000-105015000    [  400K] r-x/r-x SM=COW  /opt/apache-trunk/*

Application Specific Information:
crashed on child side of fork pre-exec
*** multi-threaded process forked ***

Thread 0 Crashed:: Dispatch queue: com.apple.security.keychain-cache-queue
0   libdispatch.dylib             	0x00007fff2017246b _dispatch_mgr_queue_push + 45
1   com.apple.security            	0x00007fff22400465 invocation function for block in Security::KeychainCore::StorageManager::tickleKeychain(Security::KeychainCore::KeychainImpl*) + 76
2   libdispatch.dylib             	0x00007fff20167806 _dispatch_client_callout + 8
3   libdispatch.dylib             	0x00007fff201745ce _dispatch_lane_barrier_sync_invoke_and_complete + 60
4   com.apple.security            	0x00007fff2240031d Security::KeychainCore::StorageManager::tickleKeychain(Security::KeychainCore::KeychainImpl*) + 535
5   com.apple.security            	0x00007fff221c2b2a Security::KeychainCore::KCCursorImpl::next(Security::KeychainCore::Item&) + 302
6   com.apple.security            	0x00007fff2240cf26 Security::KeychainCore::TrustSettings::findQualifiedCerts(std::__1::vector<Security::KeychainCore::Keychain, std::__1::allocator<Security::KeychainCore::Keychain> >&, bool, bool, cssm_data const*, char const*, unsigned int, __CFArray*) + 252
7   com.apple.security            	0x00007fff223fbef8 SecTrustSettingsCopyCertificates + 505
8   mod_tls.so                    	0x0000000105974aee security_framework::trust_settings::TrustSettings::iter::hbc4a915806f47d03 + 62 (trust_settings.rs:104)
9   mod_tls.so                    	0x000000010597108e rustls_native_certs::macos::build_native_certs::h19904d3a649b4daa + 334 (macos.rs:27)
10  mod_tls.so                    	0x000000010596fa51 rustls_native_certs::build_native_certs::h9973d1145e0a63be + 17 (lib.rs:51)
11  mod_tls.so                    	0x000000010596ed8d rustls_native_certs::rustls::load_native_certs::ha27d8a9bb3bc9dcd + 109 (rustls.rs:42)
12  mod_tls.so                    	0x00000001059595ce crustls::client::rustls_client_config_builder_load_native_roots::_$u7b$$u7b$closure$u7d$$u7d$::h0cc959449dabcf22 + 110 (client.rs:260)
13  mod_tls.so                    	0x0000000105953ab4 std::panicking::try::do_call::h642b926673fb683b + 52 (panicking.rs:381)
14  mod_tls.so                    	0x0000000105955eed __rust_try + 29
15  mod_tls.so                    	0x00000001059522b0 std::panicking::try::h6dff321a60aa6b9c + 80 (panicking.rs:345)
16  mod_tls.so                    	0x0000000105967a48 std::panic::catch_unwind::h814fefefd202a0e7 + 24 (panic.rs:396)
17  mod_tls.so                    	0x000000010593b8f1 rustls_client_config_builder_load_native_roots + 33 (client.rs:258)
18  mod_tls.so                    	0x0000000105935036 proxy_conf_setup + 238 (tls_core.c:504) [inlined]
19  mod_tls.so                    	0x0000000105935036 init_outgoing + 555 (tls_core.c:678) [inlined]
20  mod_tls.so                    	0x0000000105935036 tls_core_init + 4518 (tls_core.c:700)
21  httpd                         	0x0000000104fba3af ap_run_post_config + 79 (config.c:102)
22  httpd                         	0x0000000104fc2c81 main + 2209 (main.c:850)
23  libdyld.dylib                 	0x00007fff2032cf5d start + 1

Is there a better approach than the minimum OS version feature flags?

There have been some occasions where people introduce new APIs but forget to properly specify the respective supported OS or minimum OS version, which is understandable because it's easy to get wrong. I wouldn't be surprised if there were APIs in use today that aren't behind the correct feature flags.

Off the top of my head there might be two ways to improve the situation:

  • Make use of -mmacosx-version-min and related flags to get compile time warnings (ideally errors?) about using APIs which won't be available for the target. If this an improvement, how can we make it easy for users of the crate to use this approach? Are there any issues regarding cross compilation?
  • Perhaps bindgen could be extended to expose availability info and create feature flags for the rust implementations?

If anyone has thoughts or other suggestions I'd love to hear them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.