* [Network] Improve bindings for NWProtocolMetadata.
It turns out the NWProtocolMetadata can contain metadata for different
protocols (Ip/Tls/Tcp). This is important; if someone tries to get a value for
one protocol and the metadata is for another protocol, then they invoke the
wrath of superior beings who will smite that poor someone with uninitialized
memory.
At that point there's not much left but to pray.
I don't like to depend on divine intervention, so I've modified the API here
to check if the metadata's protocol is the required type for the native API
we're calling, and if the check fails, we throw a nice and dependable managed
exception.
This is a functional breaking change; but if there are any lost souls who
likes to pray, they can always re-implement the P/Invokes themselves and skip
the sanity checks.
In addition I've renamed a few properties whose name didn't clearly specify
which protocol type they operate on.
Ref: Apple feedback FB6155967.
Ref: https://trello.com/c/1TW0BSKJ/145-fb6155967-nwipcreatemetadata-returns-uninitialized-metadata-in-ios-13
* Fix casing in exception message.
* [tests] Adjust the SecProtocolMetadataTest according to new knowledge about the Network API.
* Fix alternative property name in obsolete attribute.
The added `SecTrustSetSignedCertificateTimestamps` API existed in older
versions of the OS so I kept the Xcode headers availability (instead of
current SDK version).
* Avoid `ArgumentNullException` in default/empty `SecProtocolMetadata.PeerPublicKey`
* Add two `SecProtocolMetadata.CreateSecret` API - disabled as the current tests (incomplete?) crash in unit tests
* Add basic unit tests for `[Sec|NW]ProtocolMetadata`
* Update xtro
* Fix many version checks to be based on Xcode version instead of iOS version.
* Added/fixed a few expected values according to platform version to match behavior in older macOS versions.
* Bump to use Xcode 10 beta 1
* Update Versions.plist
* Add a dependency on Xcode 9.4.
* [msbuild] Fix build with Xcode 10 beta 1. (#4182)
Many years ago (in Xcode 7 according to code comment)
Developer/Platforms/iPhoneOS.platform/Developer/usr disappeared, and we coped
by looking at Developer/usr instead (and also the subsequent code to locate
the bin directory was based on the location of the usr directory).
Developer/Platforms/iPhoneOS.platform/Developer/usr reappeared in Xcode 10
beta 1, but it seems useless (for one it doesn't contain a bin directory), so
in order to try to keep things sane don't look for this directory in Xcode 10
and instead go directly for Developer/usr (which is what we've been using as
the usr directory for years anyway).
Fixes this problem when building apps with Xcode 10 beta 1:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(626,3): error : Could not locate SDK bin directory [/Users/rolf/Projects/TestApp/test-app.csproj]
* [runtime] Build 32-bit mac executables using Xcode 9.4.
* [mtouch] Work around broken tvOS headers in Xcode 10 beta 1.
* [mtouch] Work around build problem with Apple's simd headers in Objective-C++ mode.
* Use version-agnostic paths to sdk directories.
* [tests][xtro] Add todo files (from unclassified) and adjust ignore files to avoid errors
* [macos][security] Re-enable SSL[Get|Set]AlpnProtocols. Fixes#4001 (#4022)
* [macos][security] Re-enable SSL[Get}Set]AlpnProtocols. Fixes#4001
This was fixed in macOS 10.13.4
https://github.com/xamarin/xamarin-macios/issues/4001
* [tests][monotouch-tests] Disable a few test cases (one crasher, other failures). Causes to be verified later
* [xharness] Fix permission dialog suppression in Xcode 10.
* [xharness] Ignore 32-bit macOS tests by default.
* [tests] Execute mmp regression tests with Xcode 9.4 since many of them are 32-bit and needs porting to 64-bit.
* [mmptest] Ignore 32-bit XM tests if we don't have a 32-bit-capable Xcode.
* [registrar] Add workaround for broken headers in Xcode 10 beta 1 (radar 40824697).
* [mtouch] Restrict another workaround for an Xcode 10 beta 1 bug to a specific Xcode version to remove it asap.
* [tests] Fix some protocol changes (public or not) find by introspection tests
* [tests][intro] Fix DefaultCtorAllowed failures
* [Intents] Obsolete several Intents classes in watchOS.
Several existing Intents classes have been marked as unavailable in watchOS in
the headers in Xcode 10 beta 1, and corresponding tests are now failing.
So obsolete the managed wrapper types, and fix tests accordingly.
* Fix xtro wrt previous Ietents/intro changes
* [tests] Minor adjustments to mtouch tests to work with Xcode 10.
* [msbuild] Update tests to cope with additional files produced by the Core ML compiler.
* [msbuild] Xcode 10 doesn't support building watchOS 1 apps, so show a clear error message explaining it.
Also update tests accordingly.
* [coreimage] Stub new filters and exclude ?removed? ones from tests
* Update GameplayKit and SpriteKit NSSecureCoding _upgrade_ and fix other non-public cases (in tests)
* [tests] Ignore some GameKit selectors that don't respond anymore (but seems to be available, at least in header files)
* [tests] Fix intro 32bits testing for filters resutls
* [msbuild] Slightly change error message to be better English.
* [security] Modifying structure of bindings
Added strong dictionary for key generation according to
https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/key_generation_attributes
in preparation making a strongly typed key generation possible.
* Making strong dictionary and composite of other strong dictionaries.
* Implementing access control as property type of SecPublicPrivateKeyAttrs.
* Adding new overload for SecKey.CreateRandomKey.
* Moving TokenID to strongly typed property.
* Fix coding style + use nameof
* Fixing Xcode version assertion of key generation tests.
* Fixing errors in test case.
* Fixing whitespace issue.
* Resolving inheritance issue
Removing inheritance between SecKeyGenerationParameters and
SecPublicPrivateKeyAttrs and instead add the necessary properties
to SecKeyGenerationParameters. Adds redundant code, but I don't
see a way around it.
* Moving test case to appropriate test class.
* Creating necessary strong dictionaries for key generation.
* [formatting] Mono coding guidelines
Make sure you're following http://www.mono-project.com/community/contributing/coding-guidelines/
In VSMac: Preferences > Source Code > Code Formatting > C# source code > Policy Mono.
* Remove [Advice] that are specific to GenerateKeyPair
`SecKeyGenerationParameters` and `SecKeyParameters` cannot be used for `GenerateKeyPair`.
* Clarify 'ArgumentException' for invalid 'SecKeyType'
* Fixed CreateRandomKeyTest
- Renamed CreateRandomKeyWithParametersTests to CreateRandomKeyTest.
- Add messages to all asserts.
```
keyGenerationParameters = new SecKeyGenerationParameters ();
keyGenerationParameters.KeyType = SecKeyType.Invalid;
Assert.Throws<ArgumentException> (() => { SecKey.CreateRandomKey (keyGenerationParameters, out _); }, "CreateRandomKey - invalid key type");
```
- ^ didn't work because `SecKeyGenerationParameters`'s setter protects against invalid. There's no constant for invalid so null is returned.
```
Assert.That (SecKey.CreateRandomKey (keyGenerationParameters, out _), Is.EqualTo (SecStatusCode.Param), "CreateRandomKey - Param issue, invalid RSA key size");
```
- ^ `SecKey.CreateRandomKey` doesn't return a `SecStatusCode` like `GenerateKeyPair`.
* Fixes based on spouliot's input.
* Mono styling fix.
* [security] Modifying structure of bindings
Added strong dictionary for key generation according to
https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/key_generation_attributes
in preparation making a strongly typed key generation possible.
* Making strong dictionary and composite of other strong dictionaries.
* Implementing access control as property type of SecPublicPrivateKeyAttrs.
* Adding new overload for SecKey.CreateRandomKey.
* Moving TokenID to strongly typed property.
* Fix coding style + use nameof
* Fixing Xcode version assertion of key generation tests.
* Fixing errors in test case.
* Fixing whitespace issue.
* Resolving inheritance issue
Removing inheritance between SecKeyGenerationParameters and
SecPublicPrivateKeyAttrs and instead add the necessary properties
to SecKeyGenerationParameters. Adds redundant code, but I don't
see a way around it.
* Moving test case to appropriate test class.
* Creating necessary strong dictionaries for key generation.
* [formatting] Mono coding guidelines
Make sure you're following http://www.mono-project.com/community/contributing/coding-guidelines/
In VSMac: Preferences > Source Code > Code Formatting > C# source code > Policy Mono.
* Remove [Advice] that are specific to GenerateKeyPair
`SecKeyGenerationParameters` and `SecKeyParameters` cannot be used for `GenerateKeyPair`.
* Clarify 'ArgumentException' for invalid 'SecKeyType'
* Fixed CreateRandomKeyTest
- Renamed CreateRandomKeyWithParametersTests to CreateRandomKeyTest.
- Add messages to all asserts.
```
keyGenerationParameters = new SecKeyGenerationParameters ();
keyGenerationParameters.KeyType = SecKeyType.Invalid;
Assert.Throws<ArgumentException> (() => { SecKey.CreateRandomKey (keyGenerationParameters, out _); }, "CreateRandomKey - invalid key type");
```
- ^ didn't work because `SecKeyGenerationParameters`'s setter protects against invalid. There's no constant for invalid so null is returned.
```
Assert.That (SecKey.CreateRandomKey (keyGenerationParameters, out _), Is.EqualTo (SecStatusCode.Param), "CreateRandomKey - Param issue, invalid RSA key size");
```
- ^ `SecKey.CreateRandomKey` doesn't return a `SecStatusCode` like `GenerateKeyPair`.
* Fixes based on spouliot's input.
* Mono styling fix.
The original test was to cover both X509Certificate and X509Certiicate2
when using with SecTrust. However the code diverged over time. That and
the different certificates used caused the `*2` tests to hit a time
loop (designed to reduce incorrect errors randomly reported).
We want to keep the "delay" logic for it's intended purpose - but it
should not be needed normally.
The tests have been refactored to reuse the same logic (between both
types of certificates) which solve this (when used with the same
certificates)
Replace https://github.com/xamarin/xamarin-macios/pull/3068
* [tests] Fix introspection tests for macOS
It seems that apple forgot to ship SSLSetALPNProtocols and SSLCopyALPNProtocols in macOS
there are already radars filled about this https://bugs.swift.org/browse/SR-6131
So this test will fail once Apple fixes this issue. when this happens we need to do two things, reenable
the API and reenable the [Get|Set]AlpnProtocols tests, the one insides 'StreamDefaults' for the mac.
* Implement feedback
* The original API was incorrect. Lack of documentation at binding time?
* Use a strong dictionary to expose the credentials
The fixed version cannot be unit tested since it popups an UI.
The test case attached to the bug report [1] can be used to verify it.
reference:
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=60423
- Updated Visual Studio max version in Make.config.
- Fixed iOS introspection tests.
- Fix monotouch-test
- Same issue with MPVolumeView as intro tests.
* Fix TrustTest
* Disable NSMutableCopying on HMCharacteristicEvent
* Fix HMCharacteristicEvent / HMMutableCharacteristicEvent
The minimum size for RSA keypairs is 1024 bits on macOS while it is
512 bits on iOS. Some tests using the minimum size (because we test the
API not the security) were disable on macOS. This re-enables them using
the platform minimum.
https://bugzilla.xamarin.com/show_bug.cgi?id=51277
- SecCertificateCopyEmailAddresses behaves differently on macOS than iOS with
macOS getting the "documented" behavior of returning an empty array and iOS
returning null.
- Fix the test to just accept null or 0 elements
They were thought to be macOS only but xtro corrected me, they are
new in iOS 10.3 even if some existed previously.
references (xtro):
!missing-pinvoke! SecCertificateCopyCommonName is not bound
!missing-pinvoke! SecCertificateCopyEmailAddresses is not bound
!missing-pinvoke! SecCertificateCopyNormalizedIssuerSequence is not bound
!missing-pinvoke! SecCertificateCopyNormalizedSubjectSequence is not bound
!missing-pinvoke! SecCertificateCopyPublicKey is not bound
!missing-pinvoke! SecCertificateCopySerialNumber is not bound
reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=52505
The exact values are not what we need to test for and varies with
different OS versions - making tests fails for no good reason (i.e.
they are not canary used to detect changes)
reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=51801
A problem, that exists with the current API, is that several constants
are hidden but many are needed in some dictionaries - and not all of
them can be turned into _classic_ StrongDictionary.
This initial PR does not solve all the (old) problems, but it does offer
some useful overloads that makes the API usable for basic usages and
expose the NSDictionary-based API.
Xcode8 SDK (for tvOS 10) marked those API with __TVOS_UNAVAILABLE making
them only available on iOS.
Since the API are not yet released in stable (C8) so we can removing
them proactively. It will be easier to add them back later (if the
situation change) than removing/obsoleting them.