diff --git a/src/Security/SecCertificate2.cs b/src/Security/SecCertificate2.cs index 378fd43fc147..c9ff0c6c9f56 100644 --- a/src/Security/SecCertificate2.cs +++ b/src/Security/SecCertificate2.cs @@ -35,8 +35,8 @@ public SecCertificate2 (SecCertificate certificate) } [DllImport (Constants.SecurityLibrary)] - extern static IntPtr sec_identity_copy_ref (IntPtr handle); + extern static /* SecCertificateRef */ IntPtr sec_certificate_copy_ref (/* OS_sec_certificate */ IntPtr handle); - public SecCertificate Certificate => new SecCertificate (sec_identity_copy_ref (GetCheckedHandle ()), owns: true); + public SecCertificate Certificate => new SecCertificate (sec_certificate_copy_ref (GetCheckedHandle ()), owns: true); } } diff --git a/src/Security/SecIdentity2.cs b/src/Security/SecIdentity2.cs index 6d5847224aea..1bef67e3202c 100644 --- a/src/Security/SecIdentity2.cs +++ b/src/Security/SecIdentity2.cs @@ -51,7 +51,7 @@ public SecIdentity2 (SecIdentity identity, SecCertificate [] certificates) } [DllImport (Constants.SecurityLibrary)] - extern static IntPtr sec_identity_copy_ref (IntPtr handle); + extern static /* SecIdentityRef */ IntPtr sec_identity_copy_ref (/* OS_sec_identity */ IntPtr handle); public SecIdentity Identity => new SecIdentity (sec_identity_copy_ref (GetCheckedHandle ()), owns: true); diff --git a/tests/monotouch-test/Security/CertificateTest.cs b/tests/monotouch-test/Security/CertificateTest.cs index 80d3eaf70052..8255217c35ec 100644 --- a/tests/monotouch-test/Security/CertificateTest.cs +++ b/tests/monotouch-test/Security/CertificateTest.cs @@ -630,5 +630,15 @@ public void GenerateKeyPairTest () } } } + + [Test] + public void X2 () + { + TestRuntime.AssertXcodeVersion (10,0); + using (var x1 = new SecCertificate (mail_google_com)) + using (var x2 = new SecCertificate2 (x1)) { + Assert.That (x2.Certificate.GetCommonName (), Is.EqualTo (x1.GetCommonName ()), "CommonName"); + } + } } } diff --git a/tests/monotouch-test/Security/IdentityTest.cs b/tests/monotouch-test/Security/IdentityTest.cs index a2d7991cf713..86d7800c991c 100644 --- a/tests/monotouch-test/Security/IdentityTest.cs +++ b/tests/monotouch-test/Security/IdentityTest.cs @@ -42,5 +42,15 @@ public void Identity () Assert.NotNull (id.Certificate, "Certificate"); } } + + [Test] + public void I2 () + { + TestRuntime.AssertXcodeVersion (10,0); + using (var i1 = GetIdentity ()) + using (var i2 = new SecIdentity2 (i1)) { + Assert.That (i1.Certificate.GetCommonName (), Is.EqualTo (i2.Identity.Certificate.GetCommonName ()), "GetCommonName"); + } + } } } diff --git a/tests/xtro-sharpie/common-Security.ignore b/tests/xtro-sharpie/common-Security.ignore index 21a95ec85864..96a89143590b 100644 --- a/tests/xtro-sharpie/common-Security.ignore +++ b/tests/xtro-sharpie/common-Security.ignore @@ -18,3 +18,11 @@ ## identical to NSObject version (headers macros) which can be called by CFObject !missing-pinvoke! sec_release is not bound !missing-pinvoke! sec_retain is not bound + +## the following are manualy bound as NativeObject +!missing-protocol! OS_sec_certificate not bound +!missing-protocol! OS_sec_identity not bound +!missing-protocol! OS_sec_object not bound +!missing-protocol! OS_sec_protocol_metadata not bound +!missing-protocol! OS_sec_protocol_options not bound +!missing-protocol! OS_sec_trust not bound diff --git a/tests/xtro-sharpie/iOS-Security.todo b/tests/xtro-sharpie/iOS-Security.todo index e159898abc74..a27cee1c2617 100644 --- a/tests/xtro-sharpie/iOS-Security.todo +++ b/tests/xtro-sharpie/iOS-Security.todo @@ -1,13 +1,6 @@ -!missing-pinvoke! sec_certificate_copy_ref is not bound !missing-pinvoke! sec_protocol_metadata_create_secret is not bound !missing-pinvoke! sec_protocol_metadata_create_secret_with_context is not bound !missing-pinvoke! sec_protocol_options_set_challenge_block is not bound !missing-pinvoke! sec_protocol_options_set_verify_block is not bound !missing-pinvoke! SecCertificateCopyKey is not bound !missing-pinvoke! SecTrustEvaluateWithError is not bound -!missing-protocol! OS_sec_certificate not bound -!missing-protocol! OS_sec_identity not bound -!missing-protocol! OS_sec_object not bound -!missing-protocol! OS_sec_protocol_metadata not bound -!missing-protocol! OS_sec_protocol_options not bound -!missing-protocol! OS_sec_trust not bound diff --git a/tests/xtro-sharpie/macOS-Security.todo b/tests/xtro-sharpie/macOS-Security.todo index cbeffe9024a1..6d1568461ca0 100644 --- a/tests/xtro-sharpie/macOS-Security.todo +++ b/tests/xtro-sharpie/macOS-Security.todo @@ -1,14 +1,7 @@ !missing-field! kSecCodeInfoRuntimeVersion not bound -!missing-pinvoke! sec_certificate_copy_ref is not bound !missing-pinvoke! sec_protocol_metadata_create_secret is not bound !missing-pinvoke! sec_protocol_metadata_create_secret_with_context is not bound !missing-pinvoke! sec_protocol_options_set_challenge_block is not bound !missing-pinvoke! sec_protocol_options_set_verify_block is not bound !missing-pinvoke! SecCertificateCopyKey is not bound !missing-pinvoke! SecTrustEvaluateWithError is not bound -!missing-protocol! OS_sec_certificate not bound -!missing-protocol! OS_sec_identity not bound -!missing-protocol! OS_sec_object not bound -!missing-protocol! OS_sec_protocol_metadata not bound -!missing-protocol! OS_sec_protocol_options not bound -!missing-protocol! OS_sec_trust not bound diff --git a/tests/xtro-sharpie/tvOS-Security.todo b/tests/xtro-sharpie/tvOS-Security.todo index e159898abc74..a27cee1c2617 100644 --- a/tests/xtro-sharpie/tvOS-Security.todo +++ b/tests/xtro-sharpie/tvOS-Security.todo @@ -1,13 +1,6 @@ -!missing-pinvoke! sec_certificate_copy_ref is not bound !missing-pinvoke! sec_protocol_metadata_create_secret is not bound !missing-pinvoke! sec_protocol_metadata_create_secret_with_context is not bound !missing-pinvoke! sec_protocol_options_set_challenge_block is not bound !missing-pinvoke! sec_protocol_options_set_verify_block is not bound !missing-pinvoke! SecCertificateCopyKey is not bound !missing-pinvoke! SecTrustEvaluateWithError is not bound -!missing-protocol! OS_sec_certificate not bound -!missing-protocol! OS_sec_identity not bound -!missing-protocol! OS_sec_object not bound -!missing-protocol! OS_sec_protocol_metadata not bound -!missing-protocol! OS_sec_protocol_options not bound -!missing-protocol! OS_sec_trust not bound diff --git a/tests/xtro-sharpie/watchOS-Security.todo b/tests/xtro-sharpie/watchOS-Security.todo index e159898abc74..a27cee1c2617 100644 --- a/tests/xtro-sharpie/watchOS-Security.todo +++ b/tests/xtro-sharpie/watchOS-Security.todo @@ -1,13 +1,6 @@ -!missing-pinvoke! sec_certificate_copy_ref is not bound !missing-pinvoke! sec_protocol_metadata_create_secret is not bound !missing-pinvoke! sec_protocol_metadata_create_secret_with_context is not bound !missing-pinvoke! sec_protocol_options_set_challenge_block is not bound !missing-pinvoke! sec_protocol_options_set_verify_block is not bound !missing-pinvoke! SecCertificateCopyKey is not bound !missing-pinvoke! SecTrustEvaluateWithError is not bound -!missing-protocol! OS_sec_certificate not bound -!missing-protocol! OS_sec_identity not bound -!missing-protocol! OS_sec_object not bound -!missing-protocol! OS_sec_protocol_metadata not bound -!missing-protocol! OS_sec_protocol_options not bound -!missing-protocol! OS_sec_trust not bound