* [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.
* [tests][monotouch] More adjustments for iOS10 related failures/changes
- some might be Apple bugs and need to be reverted later
* Fix more failures on monotouch-tests wrt iOS 10
* MutableContactTest.cs: Wrong assert was changed (which is why each one
needs it's own unique string)
* TrustTest.cs: Fixed as results vary on < iOS9, iOS9 and iOS10
* NetworkReachabilityTest.cs: Fixed as results vary on < iOS9, iOS9 and iOS10
Those
[FAIL] UserDefaultsTest.Ctor_UserName : System.NullReferenceException : Object reference not set to an instance of an object
[FAIL] UserDefaultsTest.SetString : StringForKey-2
are due to
http://stackoverflow.com/questions/37840288/ios-10-nsuserdefaults-does-not-work
and should disappear once the bots are rebooted.
* Adjust ever changing AddressFormatingTest for iOS 10, which does
not output the country;
* Adjust Contact's ICNKeyDescriptor internal check;
* CLBeaconRegion.ProximityUuid does not return the original instance
anymore, but a different one with the same uuid;
* Add a small delta for Vector3 comparison in ModelIO tests;
* Adjust MapKit tests for pin color change and MapRect corner case;
* SecKeyTest with corner cases now pass (they failed before);
* SecPolicyIdentifier.AppleIDValidation does not report the OID it's
created from (migration?)
Note: some might be bugs that Apple will fix in later seeds