Compare commits

...
197 Commits
Author SHA1 Message Date
Zoltan Varga 6d83535725 [bcl] Fix a System.Core test failure caused by a method linked away. 2016-01-21 17:24:24 -05:00
Martin Baulig 79c7c38cc6 [Mono.Security]: Add 'MonoTlsSettings.EnabledCiphers'. 2016-01-21 21:47:20 +01:00
Alexander Köplinger c43e6eb8bd Update version in configure.ac to 4.3.1 2016-01-20 14:22:37 +01:00
Martin Baulig 2d945d75bb [System]: Remove unpredictable pluggable setup and cleanup APIs. 2016-01-20 01:02:03 +01:00
Marek Habersack 8bcbed62d9 Restore accidentally bumped submodules, sorry about that 2016-01-20 00:08:21 +01:00
Alexander Köplinger 7301209fc2 [io-layer] Fix tarball broken by 39393f118d
A new file io-trace.h was added but not listed in any Makefile sources anywhere so it didn't end up in the tarball.
2016-01-19 18:37:38 +01:00
Marek Habersack 2b6077e482 Replace DEBUG messages with calls to mono_trace
The messages contain useful debugging information which is unavailable
unless the mono runtime is recompiled. The debugging information is
particularly useful on mobile platforms and in test runs on bots.

The I/O layer trace messages can be disabled on compile time by
defining the DISABLE_IO_LAYER_TRACE preprocessor symbol.
2016-01-19 18:37:38 +01:00
Marek Habersack efea2b4726 Move mono_trace to header file
This commit moves mono_trace to a header file so that all the
calls are inlined, avoiding one function call at the small expense
of binary size.
2016-01-19 18:04:10 +01:00
Martin Baulig 37d269cb52 [bcl]: Fix 'mobile_static' build.
(cherry picked from commit e442c34af4)
2016-01-18 23:46:57 +01:00
Martin Baulig 997513da02 [System]: Change namespace for some internal classes. 2016-01-18 20:50:27 +01:00
Radek Doulik a29c99aa63 [linker] improve method dependencies dumping 2016-01-18 12:30:36 +01:00
Zoltan Varga 4321e5cd9a [runtime] Make sure ptr-to-structure and structure-and-ptr wrappers are unique, this is needed by full aot. Fixes #20186. 2016-01-14 10:12:17 -05:00
Zoltan Varga aacdaf236a [aot] Avoid overwriting entries in domain->seq_points if decode_exception_debug_info () is called more than once. Fixes #37582. 2016-01-13 12:10:39 -05:00
Rolf Bjarne Kvinge 528a903cfd [System] xamarin_start_wwan is not available for tvOS and watchOS. 2016-01-13 14:53:15 +01:00
Rolf Bjarne Kvinge c318f180b0 Merge pull request #2421 from joelmartinez/mono-4.3.1-branch
[mdoc] sync mono-4.3.1-branch with mdoc commits
2016-01-12 15:05:28 +01:00
Joel Martinez 3d72bcc526 [mdoc] Added -api-style parameter.
You must now add the -api-style parameter when running mdoc update for a set of classic or unified assemblies.
This was added in order to properly support types and members that exist only in one or the other set.
Previously, there was an assumption that all types and members would be reflected in both classic and
unified versions of an assembly.
2016-01-12 06:50:09 -05:00
Joel Martinez fd4e3c9764 [mdoc] Improved error handling for multiassembly.
While there were tests included for the [multiassembly option](https://github.com/mono/mono/pull/2127), unfortunately
the tests did not consider starting from an existing repository. So this patch
rectifies the issue by improving a small function to consider the possibility
of a null result. Test that reproduced, and subsequently proves the resolution
is included here.
2016-01-12 06:49:56 -05:00
Miguel de Icaza 20d7404ea9 [mdoc] Add some diagnostics 2016-01-12 06:49:43 -05:00
Martin Baulig 76b97d3566 [Mono.Security]: Bump 'Makefile' to force 'System.dll' rebuild. 2016-01-12 12:01:04 +01:00
Rolf Bjarne Kvinge 3c588b35d2 [mscorlib] Add support for intercepting threadpool work, and use it for Xamarin.iOS/Mac.
This is used to Xamarin.iOS/Mac to wrap threadpool work in an NSAutoreleasePool.

Also open up corlib's internals to Xamarin.iOS/Mac so that the linker
doesn't have to be involved when accessing internal API.
2016-01-11 15:29:36 +01:00
Jo Shields e1b7bac978 Fix "make dist" WITHOUT accidentally un-bumping referencesources
(cherry picked from commit fcb5e103e7)
2016-01-10 20:47:17 +01:00
Vincent Povirk d85e7b8cb0 Do not define UCONTEXT_GREGS on win64.
(cherry picked from commit fa3dba9be8)
2016-01-10 20:10:01 +01:00
Jo Shields d0d92e6491 [msvc] Fix path to ml64.exe in masm.fixed.props
(cherry picked from commit e3fa11a369)
2016-01-10 19:59:35 +01:00
Alexander Köplinger cc84b6bd09 [sgen] Disable freeing of OS memory on 64bit Windows build too
This was applied for the x86 build in 398c7fc21f.
Moved the check so that it applies to the x64 MSVC build as well.

We were hitting the same assert in mono_vfree() on Jenkins and this fixes it.
2016-01-10 18:58:26 +01:00
Alexander Köplinger 83a5e2eca4 [signcode] Change default hashing algorithm from MD5 to SHA1
MD5 is considered insecure and switching the default to SHA1 should be better for everyone.

See the discussion on the mailing list: http://lists.ximian.com/pipermail/mono-devel-list/2015-December/043424.html

(cherry picked from commit f378e76b0d)
2016-01-10 18:56:12 +01:00
Alexander Köplinger 3053fb09ba [scripts] Bump xbuild script to 14.0
This means we'll use xbuild 14.0 by default, which allows users to build projects with ToolsVersion=14.0

(cherry picked from commit fb76fe4ed4)
2016-01-10 18:55:20 +01:00
Alexander Köplinger 5c74d39edb [xbuild] Add new TargetFrameworkVersion entries in Microsoft.Common.targets
Add the new 4.5.2, 4.6 and 4.6.1 versions to Microsoft.Common.targets so xbuild doesn't print "warning : TargetFrameworkVersion 'v4.6.1' not supported by this toolset".

Additionally I found a bug in the target where "and" was used instead of "or" which means the condition was never true, fixed as well.

(cherry picked from commit 51b91335be)
2016-01-10 18:54:59 +01:00
Alexander Köplinger 52f46e9211 [msvc] Automatically update (win-)config.h with the correct version number
A small powershell command grabs the version number from configure.ac and uses it during winsetup.bat,
this way we don't have to manually keep them in sync.

(cherry picked from commit 361691c2a6)
2016-01-10 18:53:00 +01:00
Alexander Köplinger c6e4b86d70 [xbuild] Add net_4.6.xml/net_4.6.1.xml and wire through xbuild
Commented the entries in ToolLocationHelper, they could be misunderstood since the 4.0/4.5/4.6 entries are all the same.

(cherry picked from commit 92d00136b1)
2016-01-10 18:46:19 +01:00
Alexander Köplinger bc4e9422ba [msvc] Remove outdated projects and configs to fix x64 build
Some of the profiler projects are no longer needed since the corresponding pieces were removed.

Update sln to only build required projects by default and update configurations in projects.

Fixes the Win64 build on Jenkins.

(cherry picked from commit a8ef200b11)
2016-01-10 18:42:16 +01:00
Alexander Köplinger f868df7ad1 [mini] Add MONO_API to mono_parse_env_options
We need this exported for our multi lib setup in MSVC.

(cherry picked from commit 96b24f637c)
2016-01-10 18:33:28 +01:00
Alexander Köplinger 1160593964 [msvc] Add missing files to libmonoutils.vcxproj
(cherry picked from commit 7ba10805f3)
2016-01-10 18:32:01 +01:00
Alexander Köplinger a635b95a9b [Facades] Fix tarball (for real this time)
Turns out EXTRA_DISTFILES only works with library.make or executable.make,
so we need to just use DISTFILES here...

(cherry picked from commit 140660e246)
2016-01-10 18:28:17 +01:00
Alexander Köplinger 9017cb95c5 [Facades] Fix tarball by adding a new file to EXTRA_DISTFILES
It was added in 29a02f2b12.

(cherry picked from commit 49051897c5)
2016-01-10 18:28:04 +01:00
Radek Doulik 3a5f494f54 [linker] do not use System.IO.Path on assembly resource names
- fixes #37305

  - resource name can be general string and using it as path
    might throw

       System.ArgumentException: Illegal characters in path.

  - it would be possible to check for the path's invalid characters in
    the resource name. that would cause crossplatform issues
    though.

    various platforms have different invalid charactes sets for path
    names. for example using assembly built on mac with embedded
    linker blacklisting xml file, which's name contains characters in
    its filename which are invalid on windows. so the windows built
    app using that assembly would fail mysteriously, because the
    important parts wouldn't be preserved.

    thus we use just string comparison
2016-01-08 21:59:02 +01:00
Rolf Bjarne Kvinge bda5fa2351 [runtime] Add API to set debug options without going through MONO_DEBUG.
This is useful for embedders.
2016-01-08 13:31:04 +01:00
Rolf Bjarne Kvinge 2c83d00c6e Bump referencesource to get changes for multiple appdomain removal. 2016-01-07 13:38:09 +01:00
Zoltan Varga a8af2a6572 [llvm] Fix support for aot data files. 2016-01-07 06:58:59 -05:00
Rolf Bjarne Kvinge e82a5ef7dd [corlib] Remove multiple appdomain support (AppDomain.CreateDomain, etc) from tvOS/watchOS. 2016-01-07 12:05:24 +01:00
Rolf Bjarne Kvinge 1cbbb44782 [aot] Fix emission of external aot data by aligning tables in the file.
The table reading code depends on data being aligned, so make sure it is.
2016-01-06 14:03:02 +01:00
Zoltan Varga f8df92a214 [llvm] Fix the linking of the bblocks containing endfinally instructions with the targets of leave instructions, previously we would link the first bblock instead of the last one. Fixes #37412. 2016-01-05 12:33:35 -05:00
Zoltan Varga 460affcfa9 [runtime] Fix the loaded llvm build. 2016-01-05 09:29:27 -05:00
Zoltan Varga 8e088ee070 [aot] Add another special case for wrappers+gshared methods. 2016-01-04 10:25:46 -05:00
Zoltan Varga 9d8d025d78 [llvm] Disable support for nested clauses, it still doesn't work. Fixes #37273. 2016-01-01 22:06:05 -05:00
Zoltan Varga 844b5e4fd4 [llvm] Add support for passing dummy arguments before arm64 hfa structures so they get passed completely on the stack, there was a mismatch between the cconv used by the JIT and LLVM, leading to problems if the caller was llvm and the callee was not, and vice versa. Part of the fix for #37236. 2016-01-01 20:14:50 -05:00
Zoltan Varga 8357c86c99 [llvm] Fix LLVM support after e7166e4f9c. 2015-12-23 01:09:40 -05:00
Rolf Bjarne Kvinge c1081e3165 Do not allow undefined references if bitcode is enabled.
The linker does not allow the '-undefined' flag when bitcode
is enabled, so we can't pass it to the linker at all.
2015-12-22 17:39:37 +01:00
Zoltan Varga 8121e75d36 [aot] Add hooks which can be used by embedders to load the aot data for aot images compiled with --aot=data-outfile=... 2015-12-21 19:15:26 -05:00
Zoltan Varga a35cd0df2d Add preliminary support for storing the AOT metadata outside the AOT image. This can save about 10-20% from the executable size when statically linking AOT images. Needs callbacks to allow embedding apps to load the aot data. 2015-12-21 19:15:12 -05:00
Martin Baulig def927b812 [System]: Cleanup the internal 'MonoTlsProviderFactory'. 2015-12-17 20:40:32 -05:00
Zoltan Varga 240304600e [aot] Fix a crash introduced by 51c4e47f2 when the mscorlib aot image is missing. 2015-12-17 14:33:36 -05:00
Sebastien Pouliot 5c0f445fcd [tests][System.Runtime.Serialization] Previous commit was missing in 4.3.1 branch and requires a fix to compile on XI 2015-12-17 09:00:12 -05:00
Miguel de Icaza ca535ed26a [System.Runtime.Serialization] Static serializer calls directly into internal APIs to fix C6 regression
With C6 we introduced a regression
https://bugzilla.xamarin.com/show_bug.cgi?id=36100, which is caused by
the new static serialization code that we wrote to reuse Microsoft's
serializer.

The code uses Invoke on a series of MethodInfos, and this obscures the
actual code that will be invoked at runtime to serialize certain
objects, causing the following exception:

Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_bool_Nullable`1<Decimal> (object,intptr,intptr,intptr)' while running with --aot-only.

This patch makes the simple code work, but a more thorough review of
the code would allow us to remove many of the slow dynamic codepaths
in the serializer.

We opted for that approach to keep the code as similar as possible to the
original.

But the code basically does this:

* Use the XmlFormatGeneratorStatics property InternalSerializeMethod,
  whose sole purpose is to delay computing the MethodInfo for the
  XmlFormatWriterGenerator's InternalSerialize.

* Use the resulting method in a few places to call the MethodInfo.

The MethodInfo was used because the original code uses Reflection.Emit
to create fast serializers and it needs handles to internal methods,
but our static rewriter does not need it.

We should replace all of those uses, but for now, this patch at least
deals with the 36100 bug.
2015-12-17 08:58:50 -05:00
Rolf Bjarne Kvinge 59faae46b2 [mono-api-info] Add new file to the csproj. 2015-12-17 12:34:07 +01:00
Zoltan Varga 9e17c5a5ab [jit] Fix the support for gshared types in mini_emit_initobj (), previously we were treating them as reference types, leading to stack overwrites. Fixes #37079. 2015-12-17 10:20:08 +01:00
David Karlaš 7dc803d5d3 [XBuild] If CurrentSolutionConfigurationContents is not set AssignProjectConfiguration can't do much so just pass references
Fixes Bug 35579 - Recent xbuild changes result in breakages to F# compiler tools(This is actual fix on master and not revert as it was on cycle 6)
2015-12-16 21:54:59 +01:00
David Karlaš 4b9ddd701a [XBuild] If Project Guid is missing on <ProjectReference> don't throw Error(same as MSBuild)
Fixes Bug 35548 - 9 new MSBuild test failures on cycle6(This is actual fix on master and not revert as it was on cycle 6)
2015-12-16 21:54:59 +01:00
Jonathan Pryor 22cbbbac9b [mono-api-info] Add mono-api-info -L, mono-api-info -r
**The Scenario**: `mono-api-info` and `mono-api-html`, together, are a
useful way to track API changes over time, specifically to check for
accidental API breakage:

	# Have a "known good" assembly version;
	# keep reference/assembly.xml in version control
	$ mono-api-info assembly.dll > reference/assembly.xml

	# ...then on every new build, check for breakage:
	$ mono-api-info assembly.dll > new-assembly.xml
	$ mono-api-html reference/assembly.xml new-assembly.xml > assembly-diff.html
	$ if grep '<p>Removed' assembly-diff.html > /dev/null ; then \
		echo "ABI BREAK IN assembly.dll" ; \
		cat assembly-diff.html ; \
	fi

This is a very nice workflow, and has been used in Xamarin.Android to
track accidental API breakage for some time.

**The problem** with the above workflow are *implicit* references:
`mono-api-info` will happily look for dependencies in the same
directory as `assembly`, but it will *also* look for assembly
references in various system-specific directories, which is fine...

...until it *isn't* fine, e.g. if you have your own version of
mscorlib.dll that you need to use, *not* the system one, as your own
version may have API differences from the system mscorlib.dll which
are "percolated" into `mono-api-info` output. For example, on
"desktop" profiles, System.Attribute implements
System.Runtime.InteropServices._Attribute, and thus *all* custom
attribute types will have _Attribute listed as an implemented
interface. The Xamarin.iOS and Xamarin.Android mscorlib.dll,
meanwhile, does *not* have System.Attribute implementing _Attribute.
Consequently, changing the mscorlib.dll which is used while processing
an assembly will change `mono-api-info` output, resulting in "API
breakage" which doens't actually exist, because the wrong mscorlib.dll
was used to generate the original API description in the first place.

We need a way to control which mscorlib.dll/etc. are used. This can be
done by allowing specification of the assembly search directories, so
that we can "override" the default system-specific directory location.

**The solution**: Add a `mono-api-info -L PATH` option which adds PATH
to the list of directories that `mono-api-info` will search when
resolving assembly references. This allows "overriding" the system
directory location, as PATH will be searched for mscorlib.dll before
the system directory location.

Additionally, add a `mono-api-info -r ASSEMBLY` option, which will
pre-process ASSEMBLY (and all dependencies) and add the directory
which contains ASSEMBLY to the assembly search paths.

These two options are conceptually similar to `mcs -L` and `mcs -r`.

Finally, while adding support for these options, add support for
`mono-api-info --help`, so that we don't need to use only the man page
to get option information.
2015-12-16 12:49:08 -05:00
Andi McClure 0bc72bdb84 Let GetTransparentProxy fail clean on load error (bug 36848)
icall for Remoting.RealProxy.GetTransparentProxy can sometimes attempt
to load an invalid class which is not previously loaded. Currently,
this leads to an assert failure in mono_class_proxy_vtable which does
not expect to be getting an invalid proxy class as input. Fix is for
the icall to load the class early and raise on failure.

A test is included.
2015-12-15 13:47:56 -05:00
Martin Baulig dcb167189d [System]: Include Mono.Security sources in XamMac profile to make it consistent with the other mobile profiles. 2015-12-14 16:21:41 -05:00
Martin Baulig f8253aeac9 [Mono.Security]: Add MonoTlsProviderFactory.GetMonoSslStream(SslStream). 2015-12-14 15:38:55 -05:00
Martin Baulig 811a40b65c [Mono.Security]: Add 'IMonoSslStream.Provider' and 'GetConnectionInfo()'. 2015-12-14 15:37:58 -05:00
Martin Baulig 562523d4af Fix some compiler warnings in Mono.Security and System. 2015-12-12 13:20:10 -05:00
Martin Baulig f56e0724dc [System]: Only use the 'MONO_SECURITY_ALIAS' conditional to determine whether or not to use 'extern alias MonoSecurity'. 2015-12-12 13:08:20 -05:00
Martin Baulig cfc81a28ab Revert "[System]: Add _HelperAsyncResults.cs from the referencesource."
Turns out that we don't actually need this.

This reverts commit 17e92c8775.
2015-12-12 12:36:59 -05:00
Ludovic Henry dd0a6c3e65 [threadpool] Fix GetAvailableThreads test 2015-12-11 18:45:38 +00:00
Ludovic Henry 6a96f28f0d [threadpool] Fix get min and available threads icalls
Fix bug #36414
2015-12-11 10:12:01 +00:00
Ludovic Henry ca758193df [delegate] Fix multicast remove behaviour
The .NET delegate removal semantic is a bit unpredictable. For example, the following (d1 + d2 + d3) - (d1 + d3) is going to return the d123 delegate, and not the d2 delegate as we could have guessed. This is because removal will remove the `list' of delegates as a whole, and not the elements in the list.

The previous implementation would then have a different behavior than the one observed on .NET.

Fixes bug #36646
2015-12-11 10:07:36 +00:00
Ludovic Henry 31e71b735a [delegate] Fix multicast Method property implementation
.NET returns the method for the last delegate of the multicast delegate.
2015-12-11 10:07:35 +00:00
Ludovic Henry 543309ffe7 [threads] Remove assertion on info for socket syscall abort
This would trigger a crash with XS on clean process exit, due to the
assertion at socket-io.c:2757.

This fixes bug 35429
2015-12-11 10:07:35 +00:00
Marek Habersack f49b93fddc Fix endless recursion in XmlCompiledTransform on mobile
One of the XmlCompiledTransform overloads called itself recursively,
leading to either a stack overflow or segfault

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=36436
2015-12-10 23:06:29 +01:00
Martin Baulig 17e92c8775 [System]: Add _HelperAsyncResults.cs from the referencesource. 2015-12-10 15:22:51 -05:00
Martin Baulig b82b0b8402 [corlib]: Cleanup X509Certificate and move the implementation-specific bits into a separate class. 2015-12-10 13:02:17 -05:00
Martin Baulig b95a41dbbd [corlib]: X509Certificate needs to implement IDisposable.
(cherry picked from commit 5da163f6f4)
2015-12-09 19:58:19 -05:00
Zoltan Varga dc6930b8b4 [sdb] Align the location of the MonoContext structure on the stack in the sdb trampolines on x86, to prevent a possible crash with memcpy. 2015-12-09 16:37:13 -05:00
Sebastien Pouliot a6f3e45a87 [corlib][tests] Disable tests that requires Windows (dllimport) on mobile profile
This enables building the tests w/bitcode enabled on AppleTV (and they
were already excluded from the results anyway).

Part of the fix for
https://bugzilla.xamarin.com/show_bug.cgi?id=36569
2015-12-05 11:22:38 -05:00
Zoltan Varga 2bf0d19a48 [jit] Increase the buffer size used by the dyncall data structures to 512, add a test for #36566. 2015-12-04 17:46:17 -05:00
Zoltan Varga ebabb14b44 Bump referencesources to pick up f67ae3facce684be53709db8b91d36f859581dc8. 2015-12-03 15:40:14 -05:00
Zoltan Varga 4f1b4b7790 [aot] Fix the emission of EnumComparer instances, some types use different comparers. 2015-12-03 15:30:47 -05:00
Zoltan Varga f092aa04a3 [jit] Avoid a verification error in gsharedvt code with ldarga + gshared types. Fixes #36292. 2015-12-02 09:09:16 +01:00
Zoltan Varga 0adaad2c6d [llvm] Zero extend array indexes when targeting llvm, this seems to work around a codegen problem on arm64. Fixes #36263. 2015-12-01 18:52:02 -05:00
Zoltan Varga e6bf5554f3 [aot] Cache inflated methods loaded from aot images to avoid repeating an expensive search. Fixes #36256. 2015-12-01 16:31:16 -05:00
Zoltan Varga 489fc4f99e [aot] Add instances of EnumEqualityCompater<T> for all integer types. Fixes #36370. 2015-12-01 16:09:28 -05:00
Zoltan Varga d81684a27b [aot] Add instances of EnumEqualityComparer which is used by EqualityComparer to compare int/uint based enums. Fixes #36370. 2015-12-01 12:42:23 -05:00
Zoltan Varga a4f8a1dc63 [gsharedvt] Fix support for constrained calls on interfaces. Fixes #36383. 2015-12-01 12:13:12 -05:00
Zoltan Varga 478b05fa6d [jit] Disable the gsharedvt version of Array.UnsafeMov. 2015-11-30 12:44:45 -05:00
Zoltan Varga b2285f8068 Revert "[llvm] Fix the passing of the this argument which got broken by 7336f89c6e883be7e0852386c5f81d0eed0ee417."
This reverts commit 0dccf251d7.

Revert this, its not needed on 4.3.1.
2015-11-30 12:40:08 -05:00
Zoltan Varga 0dccf251d7 [llvm] Fix the passing of the this argument which got broken by 7336f89c6e. 2015-11-28 22:39:19 -05:00
Zoltan Varga 2352950b70 [runtime] Fix support for MONO_ENV_OPTIONS which got broken by 8593c4dddc. 2015-11-28 22:39:02 -05:00
Zoltan Varga 683110916c [jit] Fix the verbosity of the 'LLVM failed for' messages. 2015-11-28 15:05:14 -05:00
Zoltan Varga dd518c6631 [ppdb] Fix reading of locals/scopes for the last method in the scope table. Fixes #36257. 2015-11-28 14:53:43 -05:00
Sebastien Pouliot 870f68b185 Bump referencesource to remove win32 specific p/invokes from System.Data build on the mobile profile 2015-11-27 16:27:58 -05:00
Sebastien Pouliot 704ecaa367 [System.Data] Remove unneeded files that includes win32 specific p/invokes in the mobile profile 2015-11-27 16:26:31 -05:00
Sebastien Pouliot eed35d900c [System.Xml] Do not build MS RS Win8Helpers.cs file (which includes win32-specific pinvokes) as it is unneeded for building the mobile profile 2015-11-27 08:52:14 -05:00
Rolf Bjarne Kvinge 827524cf63 [mscorlib][System] Use PlatformNotSupportedException instead of NotSupportedException when it makes sense. 2015-11-27 09:49:44 +01:00
Sebastien Pouliot a7010722e2 [System][ios] Disable non-working Ping code (and non-existing DllImport)
* capget is not part of libc (libSystem.dylib) on iOS (or OSX); and
* There's no working Process class to invoke `ping` by itself leading to

[FAIL] DllImportTest.LackOfCapget : System.InvalidOperationException : Process has not been started.
 		  at System.Diagnostics.Process.get_HasExited () [0x00039] in /Users/poupou/git/xamarin/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Diagnostics/Process.cs:184

It's technically possible to implement ping on iOS [1] so the code is
not totally removed from the build (API remains identical to existing).

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=964
2015-11-26 14:55:36 -05:00
Sebastien Pouliot 26640c4791 Bump external/referencesource for the p/invoke removal in SafeRegistryHandle 2015-11-26 11:46:59 -05:00
Sebastien Pouliot 74d30ea560 [Mono.Data.Sqlite] Remove p/invokes to symbols that are not available on iOS version of libsqlite3
/usr/lib/libsqlite3.dylib: 77 symbols
	[NOT FOUND] sqlite3_column_database_name
	[NOT FOUND] sqlite3_column_database_name16
	[NOT FOUND] sqlite3_column_origin_name
	[NOT FOUND] sqlite3_column_origin_name16
	[NOT FOUND] sqlite3_column_table_name
	[NOT FOUND] sqlite3_column_table_name16
	[NOT FOUND] sqlite3_key
	[NOT FOUND] sqlite3_rekey

note: XI has unit tests that will detect if those symbols are added in a
future version of iOS.
2015-11-26 11:45:52 -05:00
Sebastien Pouliot a2476fb2e5 [mscorlib] Do not include several win32-p/invoke calls (AccessControl) for the mobile profile 2015-11-26 11:37:39 -05:00
Sebastien Pouliot 8c049dfbe3 [mscorlib] Do not include a win32-p/invoke call (GetFullPathName) for the mobile profile 2015-11-26 11:35:35 -05:00
Zoltan Varga 2562ae43d2 Revert "[aot] Cache inflated methods loaded from aot images to avoid repeating an expensive search. Fixes #36256."
This reverts commit 579de299a4.

Revert this as it causes test failures.
2015-11-25 22:05:36 -05:00
Martin Baulig 6609e27194 [Mono.Security]: Actually rename MonoSslStream.cs into IMonoSslStream.cs. 2015-11-25 18:46:16 -05:00
Zoltan Varga 579de299a4 [aot] Cache inflated methods loaded from aot images to avoid repeating an expensive search. Fixes #36256. 2015-11-25 17:33:23 -05:00
Sebastien Pouliot 6bcd2dcbb0 Bump external/referencesource to get (DISABLE_CAS_USE) fix for #36255 2015-11-25 17:11:58 -05:00
Martin Baulig aa2166908a [Mono.Security]: Rename 'Mono.Security.Interface.MonoSslStream' into 'IMonoSslStream' and make it an interface. 2015-11-25 15:29:54 -05:00
Martin Baulig 77477b0e2b [System]: Make $(the_libdir_base)Mono.Security.dll depend on ../Mono.Security/Makefile. 2015-11-25 14:52:37 -05:00
Zoltan Varga 6843781a74 [aot] Escape some characters in method names to avoid assembler problems with obfuscated assemblies. Fixes #36247. 2015-11-25 12:32:19 -05:00
Rolf Bjarne Kvinge 1155a5450d [System.Data] Try to fix random DataViewTest.DefaultColumnNameAddListChangedTest failure.
It looks like the GC might be involved somehow in these random
failures, so make sure objects aren't freed too early.
2015-11-25 17:57:41 +01:00
Rolf Bjarne Kvinge 1864884b23 [System] Fix SmtpClientTest.Deliver_Async to not require main thread processing. 2015-11-25 14:03:56 +01:00
Rolf Bjarne Kvinge 2f4c3bb46f [System] Remove Process.Start and related API from TvOS/WatchOS. 2015-11-25 12:42:56 +01:00
Rolf Bjarne Kvinge a144ba8ec7 [corlib] Thread.ResetAbort is static. 2015-11-25 12:42:55 +01:00
Rolf Bjarne Kvinge f915605202 [corlib] Re-introduce Thread.Abort/Suspend/Resume, but make them throw NotSupportedException instead.
Re-introduce Thread.Abort/Suspend/Resume so that we don't have to
create separate PCL profiles.

Instead make them throw a NotSupportedException, and add an
[Obsolete (error: true)] attribute so that these methods can't
be used from source.
2015-11-25 12:02:35 +01:00
Martin Baulig af05134433 [Mono.Security]: Add a few more 'Mono.Security.Interface' APIs.
The following general-purpose enums and exception helpers were moved
here from Mono.Security.NewTls.Interface, which is going away.

* Alert, CipherAlgorithmType, CipherSuiteCode, ExchangeAlgorithmType,
  HashAlgorithmType, TlsConnectionInfo, TlsException, TlsProtocolCode,
  TlsProtocols.

* TlsConnectionInfo has been merged into MonoTlsConnectionInfo.

Note that you may not use 'using' statements for both 'Mono.Security.Interface'
and 'System.Security.Authentication' due to conflicting types.  Use a prefix such as
"using MSI = Mono.Security.Interface;" or "using SSA = System.Security.Authentication;"
if you need both namespaces.
2015-11-24 19:50:16 -05:00
Zoltan Varga 42841a8b49 [aot] Handle gsharedvt versions of delegate invoke wrappers correctly, there could be multiple copies of them for the same class. Fixes #36125. 2015-11-24 18:43:21 -05:00
Martin Baulig 9d6b03a587 [System]: Allow null 'settings' argument in ChainValidationHelper. 2015-11-24 14:23:31 -05:00
Sebastien Pouliot 139355c417 [system][monodroid] Remove reference to Win32NetworkInterfaceAPI (as the type was removed from the profile earlier) 2015-11-24 09:38:42 -05:00
Zoltan Varga 628f9128c1 [llvm] Fix the mapping of byref types. 2015-11-23 21:19:03 -05:00
Sebastien Pouliot 965ef3944b [system.net.http] Make HttpClient a partial class and skip default .ctor when building for iOS 2015-11-22 17:05:08 -05:00
Zoltan Varga 40ccecff4d [runtime] Implement FIXMEs in the portable ppdb code. 2015-11-21 09:31:04 -05:00
Zoltan Varga d5d3cd6b1b [runtime] Fix the loading of ppdb files. 2015-11-21 08:32:42 -05:00
Zoltan Varga 4eecc3c561 [aot] Fix support for runtime invokes to array accessors of reference arrays. Fixes #35855. 2015-11-21 06:54:23 -05:00
Sebastien Pouliot 6401d82249 [System.Data] Remove some win32-specific p/invokes for the mobile profile
This reduce the size of System.dll and also removes some Win32 specific
p/invokes.

They cause native linking issues for tvOS as Xcode 7.1 does not allow
`-u` in bitcode-enabled builds so we have to call directly the symbols
and it must exists at (native) link time.

**Incomplete** (some remains) but enough so we can run LinkSDK and
System.Data unit tests apps (the managed linker can remove the rest)
2015-11-20 21:34:58 -05:00
Zoltan Varga d075ef48bb [runtime] Use the standard __MOBILE__ define instead of MOBILE for the mini tests. 2015-11-20 17:49:22 -05:00
Martin Baulig 11d4948c49 Revert "[Mono.Security]: Add a few more 'Mono.Security.Interface' APIs."
Wrong branch, this code is not ready yet.

This reverts commit eabe8a6341.
2015-11-20 13:56:41 -05:00
Martin Baulig eabe8a6341 [Mono.Security]: Add a few more 'Mono.Security.Interface' APIs.
The following APIs where copied from mono-tls/Mono.Security.NewTls.Interface:

* Alert, CipherAlgorithmType, CipherSuiteCode, ExchangeAlgorithmType,
  HashAlgorithmType, TlsConnectionInfo, TlsExceptioni, TlsProtocolCode,
  TlsProtocols.

These are general-purpuse enums and exception / logging helpers, which
are independent from a specific TLS implementation.  Having them in
Mono.Security.dll helps getting rid of Mono.Security.NewTls.Interface.dll.
2015-11-20 13:52:01 -05:00
Martin Baulig 51226c86f9 [Mono.Security]: Minor 'Mono.Security.Interface' API improvements.
* MonoTlsSettings: Add static 'DefaultSettings' and CopyDefaultSettings().

* MonoTlsProvider: Add 'ID' and 'Name' properties.
2015-11-20 13:38:35 -05:00
Sebastien Pouliot dec6138558 [System] Remove internal Win32* classes from mobile builds
This reduce the size of System.dll and also removes some Win32 specific
p/invokes.

They cause native linking issues for tvOS as Xcode 7.1 does not allow
`-u` in bitcode-enabled builds so we have to call directly the symbols
and it must exists at (native) link time.
2015-11-20 11:59:39 -05:00
Rolf Bjarne Kvinge f49e2aa9c7 [System] Tweak tests to work with Thread.Interrupt as well. 2015-11-20 17:13:09 +01:00
Rolf Bjarne Kvinge a3342da9d3 [System] Don't throw SocketExceptions when we're stopping. 2015-11-20 17:13:08 +01:00
Sebastien Pouliot 0724a82762 [System.ServiceModel.Internals] Do not include win32 p/invokes in mobile builds
This cause native linking issues for tvOS as Xcode 7.1 does not allow
`-u` in bitcode-enabled builds so we have to call directly the symbols
and it must exists at (native) link time.
2015-11-20 10:08:30 -05:00
Rolf Bjarne Kvinge eba7d86c48 [runtime] Revert breaking changes in MonoGHashGCType.
Xamarin.iOS and Xamarin.Mac uses this enum, and changing the values
causes us to break.

For Xamarin.Mac apps that do not bundle their mono, this would break
when the user updated their system mono.
2015-11-20 14:20:22 +01:00
Rolf Bjarne Kvinge f157f6db3c [System.Drawing] Add ifdefs to source code used by Xamarin.iOS/Mac to make it compile there. 2015-11-20 12:56:13 +01:00
Zoltan Varga 1fe015afe2 [aot] Add instances of LongEnumEqualityComparer which is used by EqualityComparer to compare long/ulong based enums. 2015-11-20 06:16:18 -05:00
Zoltan Varga 92e0fa92e2 [corlib] Disable an attribute test which fails on mobile because of linking. 2015-11-20 02:31:11 -05:00
Martin Baulig e51b4ec685 [System]: Implement X509Certificate2.Export(X509ContentType.Pfx). 2015-11-19 15:23:15 -05:00
Zoltan Varga 622aeb1d4e [x86] Fix OP_IMUL_OVF_UN clobbering edx in some cases. Fixes #36052. 2015-11-19 14:20:14 -05:00
Rolf Bjarne Kvinge 31c048846e Fix mcs build to use Thread.Abort. 2015-11-19 19:28:07 +01:00
Rolf Bjarne Kvinge 25482461f4 Remove Thread API from the watch/tv runtime profiles as well. 2015-11-19 19:28:06 +01:00
Zoltan Varga 5b813a0669 [external/ikdasm] Bump to d6db90d6780d5cdb37ef97ec36d0cb452ac70e9e. 2015-11-19 09:16:36 -05:00
Rolf Bjarne Kvinge 7f3b986d89 Remove Thread.[Abort|Suspend|Resume] from TvOS/WatchOS.
In tests replace usages of Thread.Abort with Thread.Interrupt when it looks
like it can work, otherwise just disable the complete test.
2015-11-19 12:55:26 +01:00
Zoltan Varga 06d7a3542b [aot] Fix support for synchronized wrappers of gsharedvt methods. 2015-11-19 06:10:10 -05:00
Rolf Bjarne Kvinge e2b0609fb6 [mono-api-info] Take return type into account when comparing methods. 2015-11-19 10:26:37 +01:00
Rolf Bjarne Kvinge 3e53dd0781 [mono-api-info] Take into account parameters when sorting properties. 2015-11-19 10:26:37 +01:00
Rolf Bjarne Kvinge 7abb793172 [mono-api-info] Sort attributes.
So that info files can be compared textually to test for api equality.
2015-11-19 10:26:36 +01:00
Zoltan Varga 2c48c4df45 [jit] Fix memory leaks in the generic sharing code by making sure that values stored into an rgctx slot are never NULL, since otherwise the runtime would recompute them on every access. Fixes #36000. 2015-11-19 02:00:49 -05:00
Sebastien Pouliot 0823bed71d [tests] Skip Local name (incorrect) assumption for iOS/tvOS/watchOS/OSX in TimeZoneInfo tests 2015-11-18 12:30:58 -05:00
Rolf Bjarne Kvinge 0f29e3fd4c [System] Exclude code that tries to load System.Windows.Forms.dll dynamically on mobile.
It won't succeed anyway.
2015-11-18 13:38:07 +01:00
Zoltan Varga d92c873c2e [aot] Fix a memory leak in init_amodule_got (). 2015-11-17 22:37:17 -05:00
Martin Baulig e95a4a2e35 Actually, really fix my last build - sorry for the breakage. 2015-11-17 16:42:38 -05:00
Martin Baulig 4a5da6f763 Fix my last commit. 2015-11-17 16:04:48 -05:00
Martin Baulig 73e37f0ecf [Mono.Security]: Add 'X509Chain' to ICertificateValidator.InvokeSystemValidator and MonoTlsProvider.InvokeSystemCertificateValidator.
On OS X and Mobile, the X509Chain will be initialized with all the
certificates from the X509CertificateCollection, but not actually
built.

ServicePointManager.ServerCertificateValidationCallback can use the 'chain' argument
to get all the certificates from the server.
2015-11-17 15:49:12 -05:00
Rolf Bjarne Kvinge 951b60ed56 Add monotouch_*_runtime profiles for watchOS and tvOS. 2015-11-17 11:57:40 +01:00
Rolf Bjarne Kvinge 85eb387b2b Ignore extensions-config.h 2015-11-17 11:12:14 +01:00
Zoltan Varga 3b29ce1cd9 [bcl] Add versioning to the TestTasks.dll file name used by the Microsoft.Build.Engine tests since it needs to be compiled against the same xbuild version as the rest of the tests. 2015-11-17 01:33:03 -05:00
Zoltan Varga 28763a2c12 [jit] Fix the check for emulation of div instructions in 9f253965d0. 2015-11-16 22:27:50 -05:00
Martin Baulig 5022db1956 [Mono.Security]: The default value of 'MonoTlsSettings.UseServicePointManagerCallback' is supposed to be true.
This fixes a regression where ServicePointManager.ServerCertificateValidationCallback
was not called when using WebClient.
2015-11-16 21:41:15 -05:00
Marcos Henrich cffefd0f53 Updated Assert.Equals to Assert.AreEqual 2015-11-16 17:25:44 +00:00
Marcos Henrich 48a394857e [corlib] Fixes TimeZoneInfo.ParseTZBuffer abbrevs.
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=31432

In a few android devices TimeZoneInfo.ParseTZBuffer was failing ito
parse Europe/Moscow with:
at System.ThrowHelper.ThrowKeyNotFoundException ()
at System.Collections.Generic.Dictionary`2[System.Int32,System.String].get_Item (Int32 key)mscorlib/system/collections/generic/dictionary.cs:176
at System.TimeZoneInfo.ParseTimesTypes (System.Byte[] buffer, Int32 index, Int32 count, System.Collections.Generic.Dictionary`2 abbreviations) [0x0002f] in mcs/class/corlib/System/TimeZoneInfo.cs:1293
at System.TimeZoneInfo.ParseTZBuffer (System.String id, System.Byte[] buffer, Int32 length)

It was failing while getting the third index [3] from] from abbrevs.

abbrevs added values were the following:
[0, MMT]
[1, MT]
[2, T]
[4, MST]
[5, ST]
[6, T]
[8, MDST]
[9, DST]
[10, ST]
[11, T]
[13, S]
[15, M]
[17, MSK]
[18, SK]
[19, K]
[21, EET]
[22, ET]
[23, T]
[25, MSD]
[26, SD]
[27, D]
[29, EEST]
[30, EST]
[31, ST]
[32, T]

Index 3 was not added because its values is an empty string, as indexes
with empty values are used in this case we are now adding them to the
abbrevs dictionary.

Fixes #31432
2015-11-16 15:45:19 +00:00
Marcos Henrich d884c7ffeb [corlib] Tests TimeZoneInfo.ParseTZBuffer
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=31432

Tests TimeZoneInfo.ParseTZBuffer with Europe/Moscow data that thrown
at System.ThrowHelper.ThrowKeyNotFoundException ()
at System.Collections.Generic.Dictionary`2[System.Int32,System.String].get_Item (Int32 key)mscorlib/system/collections/generic/dictionary.cs:176
at System.TimeZoneInfo.ParseTimesTypes (System.Byte[] buffer, Int32 index, Int32 count, System.Collections.Generic.Dictionary`2 abbreviations) [0x0002f] in mcs/class/corlib/System/TimeZoneInfo.cs:1293
at System.TimeZoneInfo.ParseTZBuffer (System.String id, System.Byte[] buffer, Int32 length)
2015-11-16 15:45:18 +00:00
Zoltan Varga e44ea51d4f [runtime] Fix Thread.CurrentThread in non-root appdomains by setting the tls slot in start_wrapper, otherwise Thread.CurrentThread would create a new Thread object so there would be two. Fixes #35828. 2015-11-15 08:33:12 -05:00
Zoltan Varga c08f535412 [amd64] Make amd64_patch non-inline, it seems to be miscompiled by older clang versions (5.1). 2015-11-15 08:33:04 -05:00
Zoltan Varga 118040a594 [amd64] Enable div checks when running on tvos. 2015-11-13 22:42:48 -05:00
Zoltan Varga 9f253965d0 [jit] Emit div checks if MONO_ARCH_NEED_DIV_CHECK is enabled even when div instructions are not emulated. 2015-11-13 22:42:43 -05:00
Martin Baulig 42421eec1e [Mono.Security]: Cleanup the internal `Mono.Security.Interface.ICertificateValidator'.
* ICertificateValidator.SelectClientCertificate(): return bool, indicating whether
  a certificate has been selected or the caller should use its default
  implementation (if it has any).

* ICertificateValidator.ValidateCertificate(): new common function for both client
  and server certificates; replaces ValidateChain() and ValidateClientCertificate().

* MonoTlsProvider.InvokeSystemCertificateValidator(): return bool, indicating whether
  the certificate has been validator or the default system validator should be used.
2015-11-13 13:22:29 -05:00
Marek Safar c207088bd5 Bump reference source 2015-11-13 14:37:01 +01:00
Radek Doulik 94061273a9 [linker] do not try to iterate thru null array
- fixes the case when custom attribute instance constructor contains
   null value for System.Type[] array
2015-11-12 21:05:36 +01:00
Rodrigo Kumpera 151af80fc2 [jit] Allow reference types with Array.UnsafeMov. Document restrictrions in Array.cs. 2015-11-12 12:02:57 -05:00
Rodrigo Kumpera 799c7e9d0e [jit] Add support for widening of Array.UnsafeMov intrisic. Fixes #35310
This enables usage of JitHelper.UnsafeEnumCast<> with enums smaller than int.

This changes enables the intrinsic for int conversions of same reg class.
2015-11-12 12:02:50 -05:00
Rodrigo Kumpera adadb49ff5 [runtime] Fix Enum.GetHashCode when basetype is short or sbyte.
In addition to fixing the runtime, fix the test suite to correctly detect this problem.

This popped up because, for some reason, those two types have hashcodes that
don't return identity on reference sources.
2015-11-12 12:02:27 -05:00
Alexis Christoforides 15eb87998b [coop] Make sure 'gc_stackdata' is aligned and properly sized.
The size of the gc_stackdata buffer was not a multiple of 8 bytes on 64-bits, so sgen_conservatively_pin_objects_from () would address invalid memory on its last iteration, as it progresses down the buffer by pointer size. The function also expects memory references to be aligned.

This is still not a guarantee that we are aligning memory references properly as two misaligns will still give the right size, but we can catch some of them here. Proper sizing is a smaller issue because we could always pad.
2015-11-12 13:34:06 +00:00
Ludovic Henry 247e60c2ad [mini] Add safepoint support for all platforms 2015-11-12 13:34:06 +00:00
Rodrigo Kumpera b1829de7aa Merge pull request #2219 from lambdageek/dev/bug-35375-backport-4_3_1
[reflection] Fix for 35375 (4.3.1)
2015-11-11 14:24:04 -05:00
Aleksey Kliger fbf049d785 [runtime] mono_class_init() - don't look for metadata if the dynamic image doesn't have it. 2015-11-11 11:52:43 -05:00
Aleksey Kliger f0e8eac918 Crashing test in mono_class_init() from a MonoGenericClass.
[#35375](https://bugzilla.xamarin.com/show_bug.cgi?id=35375)
2015-11-11 11:52:05 -05:00
Martin Baulig f158270d86 [Mono.Security]: Add destructor to MonoSslStream. 2015-11-10 15:47:31 -05:00
Martin Baulig 4c1760785a [Mono.Security]: 'Mono.Security.Interface.MonoSslStream' needs to implement IDisposable. 2015-11-10 15:29:43 -05:00
Marcos Henrich 45d05ecbef [Facades] Moved subdirs list to subdirs.make
The list of subdirs is useful for maccore build, it was moved to its own file so it can be included in other builds makefiles.
2015-11-10 17:38:35 +00:00
Alex Rønne Petersen 627393a8fb [corlib] Disable FullNameGetTypeParseEscapeRoundtrip test on Android.
This requires the symbol writer which is not available on Android.
2015-11-10 18:34:20 +01:00
Vlad Brezae 6e8009a6ff [aot] Don't hardcode the nursery size in aot write barriers
It can be passed at runtime in the nursery-size option of MONO_GC_PARAMS environment variable.

Fixes #35414
2015-11-10 01:20:49 +02:00
Zoltan Varga fadccb411b [runtime] Add a MonoAotMode entry for llvmonly. 2015-11-06 19:48:22 -05:00
Zoltan Varga 9f65659dd5 [runtime] Add a dummy definition for mono_debug_personality (), aot compiled managed-to-native wrappers refer to it even if its not used. 2015-11-06 19:48:17 -05:00
Martin Baulig 3d81daf796 [Mono.Security]: Make MonoTlsProviderFactory.CreateHttpListener() take 'X509Certificate' instead of 'X509Certificate2'. 2015-11-06 16:41:12 -05:00
Zoltan Varga aeeb425ee7 Avoid setting mono_llvm_only when mono_aot_only is set. 2015-11-06 14:47:01 -05:00
Zoltan Varga b11f4fd6f7 [runtime] Save the nursery bits used to create wbarrier methods into the aot image, and check it at runtime. 2015-11-06 01:18:20 -05:00
Zoltan Varga 1dd2749f4e [runtime] Implement native-to-managed marshalling of byref delegate arguments. Fixes #35545. 2015-11-06 01:18:12 -05:00
Martin Baulig 4364a6b752 [Mono.Security]: Add API to let MonoTlsProvider provider a custom system certificate validator. 2015-11-05 16:26:04 -05:00
Martin Baulig 35f9501967 [Mono.Security]: Add ICertificateValidator.InvokeSystemValidator(). 2015-11-05 15:52:58 -05:00
Martin Baulig 6837c35527 [System]: Cleanup SystemCertificateValidator.Evaluate() by passing it the settings instance. 2015-11-05 15:43:16 -05:00
Martin Baulig 2dbf0a0ed1 [Mono.Security]: Add CertificateValidationHelper(MonoTlsProvider,MonoTlsSettings).
This is intended to be used by MonoTlsProvider implementations; the ChainValidationHelper
now knows about the provider (unless it's invoked directly from user code).
2015-11-05 15:22:59 -05:00
Martin Baulig fbdb69cfff [System/TLS]: Make 'SystemCertificateValidator' a static class with a single Evaluate() method. 2015-11-04 18:33:52 -05:00
Martin Baulig 0bcc31e326 [System/TLS]: Use the official API in SslStream rather than hard-coding MonoDefaultTlsProvider. 2015-11-04 16:08:27 -05:00
Martin Baulig a9afeddd80 Cosmetic; remove unused variable. 2015-11-04 15:10:29 -05:00
Martin Baulig 43307ff086 Cleanup unused usings.
Mono.Net.Security/LegacySslStream.cs is the only file which should
reference the 'Mono.Security.Protocol.Tls' namespace.
2015-11-04 15:05:00 -05:00
Alex Rønne Petersen 352334f2bd [arm] HACK: Disable fast TLS on ARM for now.
https://bugzilla.xamarin.com/show_bug.cgi?id=35178
2015-11-04 20:16:28 +01:00
Martin Baulig fff7805794 [Facades]: Remove 'System.IO.Compression'.
We do not need a 'System.IO.Compression' facade assembly because we
already have a regular assembly with the same name, which contains all
the classes from here - either as actual implementation or as type-forwarders.
2015-11-03 19:19:47 -05:00
Alex Rønne Petersen 0942a3c114 [ppdb] Fix a crash caused by mono_ppdb_load_file ().
As the `status` variable wasn't being passed along, the image loading code
would crash trying to set it.
2015-11-03 20:44:19 +01:00
Alex Rønne Petersen c325d2544e [threadpool-ms-io] Fix some crashy mono_trace () calls.
The format strings declared a string argument that wasn't being passed so the
underlying format function crashed when trying to retrieve it.
2015-11-03 20:44:06 +01:00
365 changed files with 23040 additions and 3646 deletions

No files matched your search

+1
View File
@@ -125,4 +125,5 @@ mono.h
mono-*.tar.*
tmpinst-dir.stamp
msvc/scripts/inputs/
extensions-config.h
+3 -1
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [4.3.0],
AC_INIT(mono, [4.3.1],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -3477,6 +3477,7 @@ AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to b
AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no If you want to build the Xamarin.iOS assemblies (defaults to no)], [], [with_monotouch=no])
AC_ARG_WITH(monotouch_watch, [ --with-monotouch_watch=yes,no If you want to build the Xamarin.WatchOS assemblies (defaults to no)],[], [with_monotouch_watch=no])
AC_ARG_WITH(monotouch_tv, [ --with-monotouch_tv=yes,no If you want to build the Xamarin.TVOS assemblies (defaults to no)], [], [with_monotouch_tv=no])
AC_ARG_WITH(bitcode, [ --with-bitcode=yes,no If bitcode is enabled (defaults to no)], [], [with_bitcode=no])
AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=no])
OPROFILE=no
@@ -3590,6 +3591,7 @@ AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" != "xno"])
AM_CONDITIONAL(INSTALL_MONOTOUCH_WATCH, [test "x$with_monotouch_watch" != "xno"])
AM_CONDITIONAL(INSTALL_MONOTOUCH_TV, [test "x$with_monotouch_tv" != "xno"])
AM_CONDITIONAL(BITCODE, test "x$with_bitcode" = "xyes")
AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
+1 -1
+3 -1
View File
@@ -868,7 +868,9 @@ environment variable to limit the extent of the messages you get:
If set, the log mask is changed to the set value. Possible values are
"asm" (assembly loader), "type", "dll" (native library loader), "gc"
(garbage collector), "cfg" (config file loader), "aot" (precompiler),
"security" (e.g. Moonlight CoreCLR support) and "all".
"security" (e.g. Moonlight CoreCLR support), "threadpool" (thread pool generic),
"io-threadpool" (thread pool I/O), "io-layer" (I/O layer - sockets, handles, shared memory etc)
and "all".
The default value is "all". Changing the mask value allows you to display only
messages for a certain component. You can use multiple masks by comma
separating them. For example to see config file messages and assembly loader
+2 -2
View File
@@ -27,9 +27,9 @@ The Private Key File (pvk) that contains the private key used to digitally
sign the PE executable. This private key must match the public key inside the
publisher X.509 certificate.
.TP
.I "-a md5 | sha1"
.I "-a sha1 | md5"
The hash algorithm used in the digital signature of the PE executable. The
default algorithm is MD5.
default algorithm is SHA1.
.TP
.I "-$ individual | commercial"
Add information about the publisher, i.e. if the signature is generated by an
+4
View File
@@ -11,6 +11,8 @@ monotouch_SUBDIRS := build class
monotouch_watch_SUBDIRS := build class
monotouch_tv_SUBDIRS := build class
monotouch_runtime_SUBDIRS := build class
monotouch_watch_runtime_SUBDIRS := build class
monotouch_tv_runtime_SUBDIRS := build class
xammac_SUBDIRS := build class
mobile_SUBDIRS := build class
mobile_static_SUBDIRS := build class
@@ -65,6 +67,8 @@ $(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%:
$(_boot_:%=profile-do--monotouch_watch--%): profile-do--monotouch_watch--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch_tv--%): profile-do--monotouch_tv--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch_watch_runtime--%): profile-do--monotouch_watch_runtime--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch_tv_runtime--%): profile-do--monotouch_tv_runtime--%: profile-do--build--%
$(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--%
$(_boot_:%=profile-do--xammac_net_4_5--%): profile-do--xammac_net_4_5--%: profile-do--build--%
$(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--%
+3 -41
View File
@@ -1,42 +1,4 @@
#! -*- makefile -*-
include $(topdir)/build/profiles/monotouch_runtime.make
BOOTSTRAP_PROFILE = build
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
# Use system resgen as we don't want local System.Windows.Forms dependency
RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2
profile-check:
@:
DEFAULT_REFERENCES = -r:mscorlib.dll
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
-d:NET_2_0 \
-d:NET_2_1 \
-d:NET_3_5 \
-d:NET_4_0 \
-d:NET_4_5 \
-d:MOBILE,MOBILE_LEGACY \
-d:MONO \
-d:DISABLE_CAS_USE \
-d:MONOTOUCH \
-d:DISABLE_REMOTING \
-d:DISABLE_COM \
-d:FULL_AOT_RUNTIME \
-nowarn:1699 \
-nostdlib \
-lib:$(topdir)/class/lib/$(PROFILE) \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 2.1
NO_TEST = yes
# the tuner takes care of the install
NO_INSTALL = yes
MOBILE_STATIC = yes
MOBILE_PROFILE = yes
PROFILE_MCS_FLAGS += \
-d:FULL_AOT_RUNTIME
+19 -1
View File
@@ -14,7 +14,25 @@ profile-check:
@:
DEFAULT_REFERENCES = -r:mscorlib.dll
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -d:MOBILE,MOBILE_LEGACY -d:MONOTOUCH -D:DISABLE_REMOTING -d:DISABLE_COM -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
-d:NET_2_0 \
-d:NET_2_1 \
-d:NET_3_5 \
-d:NET_4_0 \
-d:NET_4_5 \
-d:MOBILE,MOBILE_LEGACY \
-d:MONO \
-d:DISABLE_CAS_USE \
-d:MONOTOUCH \
-d:DISABLE_REMOTING \
-d:DISABLE_COM \
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
-nowarn:1699 \
-nostdlib \
-lib:$(topdir)/class/lib/$(PROFILE) \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 2.1
+5
View File
@@ -2,3 +2,8 @@ include $(topdir)/build/profiles/monotouch.make
PROFILE_MCS_FLAGS += \
-d:MONOTOUCH_TV
NO_THREAD_ABORT=1
NO_THREAD_SUSPEND_RESUME=1
NO_MULTIPLE_APPDOMAINS=1
NO_PROCESS_START=1
@@ -0,0 +1,10 @@
include $(topdir)/build/profiles/monotouch_runtime.make
PROFILE_MCS_FLAGS += \
-d:MONOTOUCH_TV
NO_THREAD_ABORT=1
NO_THREAD_SUSPEND_RESUME=1
# The binding generator (btv) still needs to execute processes,
# so we need a System.dll that can do that.
#NO_PROCESS_START=1
+5
View File
@@ -2,3 +2,8 @@ include $(topdir)/build/profiles/monotouch.make
PROFILE_MCS_FLAGS += \
-d:MONOTOUCH_WATCH
NO_THREAD_ABORT=1
NO_THREAD_SUSPEND_RESUME=1
NO_MULTIPLE_APPDOMAINS=1
NO_PROCESS_START=1
@@ -0,0 +1,10 @@
include $(topdir)/build/profiles/monotouch_runtime.make
PROFILE_MCS_FLAGS += \
-d:MONOTOUCH_WATCH
NO_THREAD_ABORT=1
NO_THREAD_SUSPEND_RESUME=1
# The binding generator (bwatch) still needs to execute processes,
# so we need a System.dll that can do that.
#NO_PROCESS_START=1
+1
View File
@@ -23,6 +23,7 @@ PROFILE_MCS_FLAGS = \
-d:MOBILE \
-d:MOBILE_DYNAMIC \
-d:XAMMAC \
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
-nowarn:1699 \
-nostdlib \
-lib:$(topdir)/class/lib/$(PROFILE) \
+6 -1
View File
@@ -1,5 +1,10 @@
include $(topdir)/build/profiles/net_4_x.make
PROFILE_MCS_FLAGS += -d:NO_SYSTEM_DRAWING_DEPENDENCY -d:NO_WINFORMS_DEPENDENCY -d:NO_SYSTEM_WEB_DEPENDENCY -d:XAMMAC_4_5
PROFILE_MCS_FLAGS += \
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
-d:NO_SYSTEM_DRAWING_DEPENDENCY \
-d:NO_WINFORMS_DEPENDENCY \
-d:NO_SYSTEM_WEB_DEPENDENCY \
-d:XAMMAC_4_5
XAMMAC_4_5=1
NO_WINDOWS_BASE=1
NO_SYSTEM_WEB_DEPENDENCY=1
+2 -40
View File
@@ -2,46 +2,7 @@ MCS_BUILD_DIR = ../../build
thisdir = class/Facades
monotouch_PARALLEL_SUBDIRS = System.Collections.Concurrent System.Collections System.ComponentModel.Annotations System.ComponentModel.EventBasedAsync System.ComponentModel \
System.Diagnostics.Contracts System.Diagnostics.Debug System.Diagnostics.Tracing System.Diagnostics.Tools System.Dynamic.Runtime System.Globalization System.IO System.Linq.Expressions \
System.Linq.Parallel System.Linq.Queryable System.Linq System.Net.NetworkInformation System.Net.Primitives System.Net.Requests System.ObjectModel \
System.Reflection.Extensions System.Reflection.Primitives System.Reflection System.Resources.ResourceManager System.Runtime.Extensions \
System.Runtime.InteropServices System.Runtime.InteropServices.WindowsRuntime System.Runtime.Numerics System.Runtime.Serialization.Json \
System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml System.Runtime System.Security.Principal System.ServiceModel.Http \
System.ServiceModel.Primitives System.ServiceModel.Security System.Text.Encoding.Extensions System.Text.Encoding System.Text.RegularExpressions System.Threading.Tasks.Parallel \
System.Threading.Tasks System.Threading.Timer System.Threading System.Xml.ReaderWriter System.Xml.XDocument System.Xml.XmlSerializer \
System.Runtime.Handles System.ServiceModel.Duplex System.ServiceModel.NetTcp \
Microsoft.Win32.Primitives Microsoft.Win32.Registry System.AppContext System.Collections.NonGeneric System.Collections.Specialized System.ComponentModel.Primitives \
System.ComponentModel.TypeConverter System.Console System.Data.Common System.Data.SqlClient System.Diagnostics.FileVersionInfo \
System.Diagnostics.Process System.Diagnostics.TextWriterTraceListener System.Diagnostics.TraceEvent System.Diagnostics.TraceSource System.Globalization.Calendars \
System.IO.Compression System.IO.Compression.ZipFile System.IO.FileSystem System.IO.FileSystem.DriveInfo System.IO.FileSystem.Primitives \
System.IO.IsolatedStorage System.IO.MemoryMappedFiles System.IO.UnmanagedMemoryStream System.Net.AuthenticationManager System.Net.Cache \
System.Net.HttpListener System.Net.Mail System.Net.NameResolution System.Net.Security System.Net.ServicePoint System.Net.Sockets \
System.Net.Utilities System.Net.WebHeaderCollection System.Net.WebSockets System.Net.WebSockets.Client System.Resources.ReaderWriter System.Runtime.CompilerServices.VisualC \
System.Security.AccessControl System.Security.Claims System.Security.Cryptography.DeriveBytes System.Security.Cryptography.Encoding System.Security.Cryptography.Encryption \
System.Security.Cryptography.Encryption.Aes System.Security.Cryptography.Encryption.ECDiffieHellman System.Security.Cryptography.Encryption.ECDsa System.Security.Cryptography.Hashing \
System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA System.Security.Cryptography.RandomNumberGenerator \
System.Security.Cryptography.X509Certificates System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.Globalization.Extensions \
System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Private.CoreLib.Threading System.Reflection.TypeExtensions \
System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument
reflection_PARALLEL_SUBDIRS = System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
mobile_static_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
net_4_x_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS) System.Diagnostics.PerformanceCounter \
System.IO.FileSystem.Watcher System.IO.Pipes System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.Net.Http.WebRequestHandler
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
xammac_net_4_5_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
monotouch_tv_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
PROFILE_PARALLEL_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
include subdirs.make
#OVERRIDE_TARGET_ALL = yes
@@ -68,6 +29,7 @@ include $(MCS_BUILD_DIR)/rules.make
dist-local: dist-default
DIST_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
DISTFILES=subdirs.make
doc-update-local:
@echo "not doing docs"
@@ -1,23 +0,0 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.IO.Compression
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.IO.Compression.dll
KEY_FILE = ../../msfinal.pub
SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib /r:System.IO.Compression.dll
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DA6DA8FE-0BF4-43C5-9BF8-896409EBDA70}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1616,1699,1699,1616,1699</NoWarn>
<OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>System.IO.Compression</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699,1616,1699,1699,1616,1699</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699,1616,1699,1699,1616,1699</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="TypeForwarders.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<Reference Include="System.IO.Compression.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>System.IO.Compression.dll</HintPath>
<Private>False</Private>
</Reference>
<ProjectReference Include="../../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -1,3 +0,0 @@
TypeForwarders.cs
AssemblyInfo.cs
+45
View File
@@ -0,0 +1,45 @@
# This file should only contain SUBDIRS variables
# Caution while renaming SUBDIRS variables as those are used outside mono repository.
# ie: macccore/builds/Makefile
monotouch_PARALLEL_SUBDIRS = System.Collections.Concurrent System.Collections System.ComponentModel.Annotations System.ComponentModel.EventBasedAsync System.ComponentModel \
System.Diagnostics.Contracts System.Diagnostics.Debug System.Diagnostics.Tracing System.Diagnostics.Tools System.Dynamic.Runtime System.Globalization System.IO System.Linq.Expressions \
System.Linq.Parallel System.Linq.Queryable System.Linq System.Net.NetworkInformation System.Net.Primitives System.Net.Requests System.ObjectModel \
System.Reflection.Extensions System.Reflection.Primitives System.Reflection System.Resources.ResourceManager System.Runtime.Extensions \
System.Runtime.InteropServices System.Runtime.InteropServices.WindowsRuntime System.Runtime.Numerics System.Runtime.Serialization.Json \
System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml System.Runtime System.Security.Principal System.ServiceModel.Http \
System.ServiceModel.Primitives System.ServiceModel.Security System.Text.Encoding.Extensions System.Text.Encoding System.Text.RegularExpressions System.Threading.Tasks.Parallel \
System.Threading.Tasks System.Threading.Timer System.Threading System.Xml.ReaderWriter System.Xml.XDocument System.Xml.XmlSerializer \
System.Runtime.Handles System.ServiceModel.Duplex System.ServiceModel.NetTcp \
Microsoft.Win32.Primitives Microsoft.Win32.Registry System.AppContext System.Collections.NonGeneric System.Collections.Specialized System.ComponentModel.Primitives \
System.ComponentModel.TypeConverter System.Console System.Data.Common System.Data.SqlClient System.Diagnostics.FileVersionInfo \
System.Diagnostics.Process System.Diagnostics.TextWriterTraceListener System.Diagnostics.TraceEvent System.Diagnostics.TraceSource System.Globalization.Calendars \
System.IO.Compression.ZipFile System.IO.FileSystem System.IO.FileSystem.DriveInfo System.IO.FileSystem.Primitives \
System.IO.IsolatedStorage System.IO.MemoryMappedFiles System.IO.UnmanagedMemoryStream System.Net.AuthenticationManager System.Net.Cache \
System.Net.HttpListener System.Net.Mail System.Net.NameResolution System.Net.Security System.Net.ServicePoint System.Net.Sockets \
System.Net.Utilities System.Net.WebHeaderCollection System.Net.WebSockets System.Net.WebSockets.Client System.Resources.ReaderWriter System.Runtime.CompilerServices.VisualC \
System.Security.AccessControl System.Security.Claims System.Security.Cryptography.DeriveBytes System.Security.Cryptography.Encoding System.Security.Cryptography.Encryption \
System.Security.Cryptography.Encryption.Aes System.Security.Cryptography.Encryption.ECDiffieHellman System.Security.Cryptography.Encryption.ECDsa System.Security.Cryptography.Hashing \
System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA System.Security.Cryptography.RandomNumberGenerator \
System.Security.Cryptography.X509Certificates System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.Globalization.Extensions \
System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Private.CoreLib.Threading System.Reflection.TypeExtensions \
System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument
reflection_PARALLEL_SUBDIRS = System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
mobile_static_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
net_4_x_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS) System.Diagnostics.PerformanceCounter \
System.IO.FileSystem.Watcher System.IO.Pipes System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.Net.Http.WebRequestHandler
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
xammac_net_4_5_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
monotouch_tv_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
PROFILE_PARALLEL_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
+11 -3
View File
@@ -54,7 +54,8 @@ mobile_common_dirs := \
Microsoft.CSharp \
Mono.Security.Providers.DotNet \
Mono.Security.Providers.OldTls \
Mono.Security.Providers.NewSystemSource
Mono.Security.Providers.NewSystemSource \
Mono.Security.Providers.NewTls
mobile_static_dirs := \
$(mobile_common_dirs) \
@@ -85,6 +86,9 @@ monotouch_runtime_dirs := \
System.XML \
Mono.CSharp
monotouch_watch_runtime_dirs := $(monotouch_runtime_dirs)
monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs)
xammac_4_5_dirs := \
corlib \
System \
@@ -130,6 +134,7 @@ xammac_4_5_dirs := \
Mono.Security.Providers.DotNet \
Mono.Security.Providers.OldTls \
Mono.Security.Providers.NewSystemSource \
Mono.Security.Providers.NewTls \
$(pcl_facade_dirs)
net_4_x_dirs := \
@@ -214,7 +219,9 @@ net_4_x_dirs := \
System.Net.Http.Formatting \
System.Web.Http \
System.Web.Http.SelfHost \
System.Web.Http.WebHost
System.Web.Http.WebHost \
Mono.Security.Providers.NewSystemSource \
Mono.Security.Providers.NewTls
# These are the subdirs which depends on libs in net_4_x_dirs
# or have proper dependencies between each other
@@ -259,7 +266,6 @@ net_4_x_parallel_dirs := \
System.Xml.Serialization \
Mono.Security.Providers.DotNet \
Mono.Security.Providers.OldTls \
Mono.Security.Providers.NewSystemSource \
System.DirectoryServices.Protocols \
RabbitMQ.Client \
Microsoft.VisualC \
@@ -283,6 +289,8 @@ monotouch_SUBDIRS := $(monotouch_dirs)
monotouch_watch_SUBDIRS := $(monotouch_watch_dirs)
monotouch_tv_SUBDIRS := $(monotouch_tv_dirs)
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
monotouch_watch_runtime_SUBDIRS := $(monotouch_watch_runtime_dirs)
monotouch_tv_runtime_SUBDIRS := $(monotouch_tv_runtime_dirs)
mobile_static_SUBDIRS := $(mobile_static_dirs)
mobile_SUBDIRS := $(mobile_dynamic_dirs)
xammac_SUBDIRS := $(xammac_dirs)
+8 -4
View File
@@ -26,13 +26,17 @@ EXTRA_DISTFILES = \
Test/resources/*.*proj \
Test/resources/*.csproj
Test/resources/TestTasks.dll: Test/resources/TestTasks.cs
$(CSCOMPILE) Test/resources/TestTasks.cs /r:$(XBUILD_FRAMEWORK) /r:$(XBUILD_UTILITIES) /target:library
Test/resources/TestTasks-$(PROFILE).dll: Test/resources/TestTasks.cs
$(CSCOMPILE) /out:$@ Test/resources/TestTasks.cs /r:$(XBUILD_FRAMEWORK) /r:$(XBUILD_UTILITIES) /target:library
clean-test-resources:
rm -f Test/resources/TestTasks.dll
rm -f Test/resources/TestTasks*.dll Test/resources/TestTasks*.dll.mdb
test-local: Test/resources/TestTasks.dll
test-local: compile-resources
compile-resources: Test/resources/TestTasks-$(PROFILE).dll
cp Test/resources/TestTasks-$(PROFILE).dll Test/resources/TestTasks.dll
cp Test/resources/TestTasks-$(PROFILE).dll.mdb Test/resources/TestTasks.dll.mdb
clean-local: clean-test-resources
@@ -87,14 +87,15 @@ namespace Microsoft.Build.Tasks {
string config;
string guid_str = item.GetMetadata ("Project");
Guid guid;
if (!TryParseGuid (guid_str, out guid)) {
Guid guid = Guid.Empty;
if (!string.IsNullOrEmpty(guid_str) && !TryParseGuid (guid_str, out guid)) {
Log.LogError ("Project reference '{0}' has invalid or missing guid for metadata 'Project'.",
item.ItemSpec);
return false;
}
if (guidToConfigPlatform.TryGetValue (guid, out config)) {
if (guid != Guid.Empty && guidToConfigPlatform.TryGetValue (guid, out config)) {
string [] parts = config.Split (new char [] {'|'}, 2);
ITaskItem new_item = new TaskItem (item);
@@ -48,11 +48,12 @@ namespace Microsoft.Build.Utilities
Version451,
#endif
#if XBUILD_14
Version453,
Version46,
Version461,
#endif
#if XBUILD_14
VersionLatest = Version453
VersionLatest = Version461
#elif XBUILD_12
VersionLatest = Version451
#else
@@ -61,41 +61,44 @@ namespace Microsoft.Build.Utilities
runningOnDotNet = !string.IsNullOrEmpty (windowsPath) && lib_mono_dir.StartsWith (windowsPath);
if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null) {
mono_dir = new string [] {
Path.Combine (lib_mono_dir, "net_1_0"),
Path.Combine (lib_mono_dir, "net_2_0"),
Path.Combine (lib_mono_dir, "net_2_0"),
Path.Combine (lib_mono_dir, "net_3_5"),
mono_dir = new string [] { // TargetDotNetFrameworkVersion:
Path.Combine (lib_mono_dir, "net_1_0"), // Version11
Path.Combine (lib_mono_dir, "net_2_0"), // Version20
Path.Combine (lib_mono_dir, "net_2_0"), // Version30
Path.Combine (lib_mono_dir, "net_3_5"), // Version35
// mono's 4.0 is not an actual framework directory with all tools etc
// it's simply reference assemblies. So like .NET we consider 4.5 to
// be a complete replacement for 4.0.
Path.Combine (lib_mono_dir, "net_4_x"),
Path.Combine (lib_mono_dir, "net_4_x"),
Path.Combine (lib_mono_dir, "net_4_x"),
Path.Combine (lib_mono_dir, "net_4_x")
Path.Combine (lib_mono_dir, "net_4_x"), // Version40
Path.Combine (lib_mono_dir, "net_4_x"), // Version45
Path.Combine (lib_mono_dir, "net_4_x"), // Version451
Path.Combine (lib_mono_dir, "net_4_x"), // Version46
Path.Combine (lib_mono_dir, "net_4_x"), // Version461
};
} else if (runningOnDotNet) {
mono_dir = new string [] {
Path.Combine (lib_mono_dir, "v1.0.3705"),
Path.Combine (lib_mono_dir, "v2.0.50727"),
Path.Combine (lib_mono_dir, "v2.0.50727"),
Path.Combine (lib_mono_dir, "v3.5"),
Path.Combine (lib_mono_dir, "v4.0.30319"),
Path.Combine (lib_mono_dir, "v4.0.30319"),
Path.Combine (lib_mono_dir, "v4.0.30319"),
Path.Combine (lib_mono_dir, "v4.0.30319")
Path.Combine (lib_mono_dir, "v1.0.3705"), // Version11
Path.Combine (lib_mono_dir, "v2.0.50727"), // Version20
Path.Combine (lib_mono_dir, "v2.0.50727"), // Version30
Path.Combine (lib_mono_dir, "v3.5"), // Version35
Path.Combine (lib_mono_dir, "v4.0.30319"), // Version40
Path.Combine (lib_mono_dir, "v4.0.30319"), // Version45
Path.Combine (lib_mono_dir, "v4.0.30319"), // Version451
Path.Combine (lib_mono_dir, "v4.0.30319"), // Version46
Path.Combine (lib_mono_dir, "v4.0.30319"), // Version461
};
} else {
mono_dir = new string [] {
Path.Combine (lib_mono_dir, "1.0"),
Path.Combine (lib_mono_dir, "2.0"),
Path.Combine (lib_mono_dir, "2.0"),
Path.Combine (lib_mono_dir, "3.5"),
Path.Combine (lib_mono_dir, "1.0"), // Version11
Path.Combine (lib_mono_dir, "2.0"), // Version20
Path.Combine (lib_mono_dir, "2.0"), // Version30
Path.Combine (lib_mono_dir, "3.5"), // Version35
// see comment above regarding 4.0/4.5
Path.Combine (lib_mono_dir, "4.5"),
Path.Combine (lib_mono_dir, "4.5"),
Path.Combine (lib_mono_dir, "4.5"),
Path.Combine (lib_mono_dir, "4.5")
Path.Combine (lib_mono_dir, "4.5"), // Version40
Path.Combine (lib_mono_dir, "4.5"), // Version45
Path.Combine (lib_mono_dir, "4.5"), // Version451
Path.Combine (lib_mono_dir, "4.5"), // Version46
Path.Combine (lib_mono_dir, "4.5"), // Version461
};
}
+6
View File
@@ -11,7 +11,13 @@ ifdef MOBILE_STATIC
LIB_MCS_FLAGS += -d:IOS_REFLECTION
endif
ifndef NO_THREAD_ABORT
REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT
endif
TEST_MCS_FLAGS = -r:System.Core.dll
LIB_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS)
include ../../build/library.make
@@ -499,6 +499,8 @@ namespace Mono.Data.Sqlite
#if !SQLITE_STANDARD
int len;
return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len);
#elif MONOTOUCH
throw new NotImplementedException ();
#else
return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1);
#endif
@@ -509,6 +511,8 @@ namespace Mono.Data.Sqlite
#if !SQLITE_STANDARD
int len;
return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len);
#elif MONOTOUCH
throw new NotImplementedException ();
#else
return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1);
#endif
@@ -519,6 +523,8 @@ namespace Mono.Data.Sqlite
#if !SQLITE_STANDARD
int len;
return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len);
#elif MONOTOUCH
throw new NotImplementedException ();
#else
return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1);
#endif
@@ -923,6 +929,17 @@ namespace Mono.Data.Sqlite
return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1);
}
#if MONOTOUCH
internal override void SetPassword(byte[] passwordBytes)
{
throw new NotImplementedException ();
}
internal override void ChangePassword(byte[] newPasswordBytes)
{
throw new NotImplementedException ();
}
#else
internal override void SetPassword(byte[] passwordBytes)
{
int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length);
@@ -934,6 +951,7 @@ namespace Mono.Data.Sqlite
int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);
if (n > 0) throw new SqliteException(n, SQLiteLastError());
}
#endif
#if MONOTOUCH
SQLiteUpdateCallback update_callback;
@@ -112,6 +112,8 @@ namespace Mono.Data.Sqlite
#if !SQLITE_STANDARD
int len;
return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, out len), len);
#elif MONOTOUCH
throw new NotImplementedException ();
#else
return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16(stmt._sqlite_stmt, index), -1);
#endif
@@ -122,6 +124,8 @@ namespace Mono.Data.Sqlite
#if !SQLITE_STANDARD
int len;
return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, out len), len);
#elif MONOTOUCH
throw new NotImplementedException ();
#else
return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16(stmt._sqlite_stmt, index), -1);
#endif
@@ -132,6 +136,8 @@ namespace Mono.Data.Sqlite
#if !SQLITE_STANDARD
int len;
return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, out len), len);
#elif MONOTOUCH
throw new NotImplementedException ();
#else
return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16(stmt._sqlite_stmt, index), -1);
#endif
@@ -200,6 +200,8 @@ namespace Mono.Data.Sqlite
#endif
internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index);
// Apple does not include those symbols in it's libsqlite3
#if !MONOTOUCH
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
@@ -213,6 +215,7 @@ namespace Mono.Data.Sqlite
[DllImport(SQLITE_DLL)]
#endif
internal static extern IntPtr sqlite3_column_database_name16(IntPtr stmt, int index);
#endif
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
@@ -242,6 +245,7 @@ namespace Mono.Data.Sqlite
#endif
internal static extern IntPtr sqlite3_column_name16(IntPtr stmt, int index);
#if !MONOTOUCH
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
@@ -269,6 +273,7 @@ namespace Mono.Data.Sqlite
[DllImport(SQLITE_DLL)]
#endif
internal static extern IntPtr sqlite3_column_table_name16(IntPtr stmt, int index);
#endif // !MONOTOUCH
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
@@ -646,6 +651,7 @@ namespace Mono.Data.Sqlite
#endif
internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved);
#if !MONOTOUCH
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
@@ -659,6 +665,7 @@ namespace Mono.Data.Sqlite
[DllImport(SQLITE_DLL)]
#endif
internal static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen);
#endif
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
@@ -10,3 +10,5 @@ EXTRA_DISTFILES = README.md
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -33,12 +33,13 @@ using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Security.Cryptography;
using Mono.Security.Interface;
using MSI = Mono.Security.Interface;
namespace Mono.Security.Providers.DotNet
{
class DotNetSslStreamImpl : MonoSslStream
class DotNetSslStreamImpl : MSI.IMonoSslStream
{
DotNetTlsProvider provider;
SslStream impl;
internal SslStream Impl {
@@ -49,218 +50,219 @@ namespace Mono.Security.Providers.DotNet
}
public DotNetSslStreamImpl (
Stream innerStream, bool leaveInnerStreamOpen,
Stream innerStream, bool leaveInnerStreamOpen, DotNetTlsProvider provider,
RemoteCertificateValidationCallback userCertificateValidationCallback,
LocalCertificateSelectionCallback userCertificateSelectionCallback)
{
this.provider = provider;
impl = new SslStream (
innerStream, leaveInnerStreamOpen,
userCertificateValidationCallback,
userCertificateSelectionCallback);
}
public override void AuthenticateAsClient (string targetHost)
public void AuthenticateAsClient (string targetHost)
{
Impl.AuthenticateAsClient (targetHost);
}
public override void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
}
public override IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsClient (targetHost, asyncCallback, asyncState);
}
public override IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
}
public override void EndAuthenticateAsClient (IAsyncResult asyncResult)
public void EndAuthenticateAsClient (IAsyncResult asyncResult)
{
Impl.EndAuthenticateAsClient (asyncResult);
}
public override void AuthenticateAsServer (X509Certificate serverCertificate)
public void AuthenticateAsServer (X509Certificate serverCertificate)
{
Impl.AuthenticateAsServer (serverCertificate);
}
public override void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
}
public override IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsServer (serverCertificate, asyncCallback, asyncState);
}
public override IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
}
public override void EndAuthenticateAsServer (IAsyncResult asyncResult)
public void EndAuthenticateAsServer (IAsyncResult asyncResult)
{
Impl.EndAuthenticateAsServer (asyncResult);
}
public override Task AuthenticateAsClientAsync (string targetHost)
public Task AuthenticateAsClientAsync (string targetHost)
{
return Impl.AuthenticateAsClientAsync (targetHost);
}
public override Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
}
public override Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
{
return Impl.AuthenticateAsServerAsync (serverCertificate);
}
public override Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
}
public override void Flush ()
public void Flush ()
{
Impl.Flush ();
}
public override int Read (byte[] buffer, int offset, int count)
public int Read (byte[] buffer, int offset, int count)
{
return Impl.Read (buffer, offset, count);
}
public override void Write (byte[] buffer)
public void Write (byte[] buffer)
{
Impl.Write (buffer);
}
public override void Write (byte[] buffer, int offset, int count)
public void Write (byte[] buffer, int offset, int count)
{
Impl.Write (buffer, offset, count);
}
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginRead (buffer, offset, count, asyncCallback, asyncState);
}
public override int EndRead (IAsyncResult asyncResult)
public int EndRead (IAsyncResult asyncResult)
{
return Impl.EndRead (asyncResult);
}
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
return Impl.BeginWrite (buffer, offset, count, asyncCallback, asyncState);
}
public override void EndWrite (IAsyncResult asyncResult)
public void EndWrite (IAsyncResult asyncResult)
{
Impl.EndWrite (asyncResult);
}
public override TransportContext TransportContext {
public TransportContext TransportContext {
get { throw new NotSupportedException (); }
}
public override bool IsAuthenticated {
public bool IsAuthenticated {
get { return Impl.IsAuthenticated; }
}
public override bool IsMutuallyAuthenticated {
public bool IsMutuallyAuthenticated {
get { return Impl.IsMutuallyAuthenticated; }
}
public override bool IsEncrypted {
public bool IsEncrypted {
get { return Impl.IsEncrypted; }
}
public override bool IsSigned {
public bool IsSigned {
get { return Impl.IsSigned; }
}
public override bool IsServer {
public bool IsServer {
get { return Impl.IsServer; }
}
public override CipherAlgorithmType CipherAlgorithm {
public CipherAlgorithmType CipherAlgorithm {
get { return Impl.CipherAlgorithm; }
}
public override int CipherStrength {
public int CipherStrength {
get { return Impl.CipherStrength; }
}
public override HashAlgorithmType HashAlgorithm {
public HashAlgorithmType HashAlgorithm {
get { return Impl.HashAlgorithm; }
}
public override int HashStrength {
public int HashStrength {
get { return Impl.HashStrength; }
}
public override ExchangeAlgorithmType KeyExchangeAlgorithm {
public ExchangeAlgorithmType KeyExchangeAlgorithm {
get { return Impl.KeyExchangeAlgorithm; }
}
public override int KeyExchangeStrength {
public int KeyExchangeStrength {
get { return KeyExchangeStrength; }
}
public override bool CanRead {
public bool CanRead {
get { return Impl.CanRead; }
}
public override bool CanTimeout {
public bool CanTimeout {
get { return Impl.CanTimeout; }
}
public override bool CanWrite {
public bool CanWrite {
get { return Impl.CanWrite; }
}
public override long Length {
public long Length {
get { return Impl.Length; }
}
public override long Position {
public long Position {
get { return Impl.Position; }
}
public override void SetLength (long value)
public void SetLength (long value)
{
Impl.SetLength (value);
}
public override AuthenticatedStream AuthenticatedStream {
public AuthenticatedStream AuthenticatedStream {
get { return Impl; }
}
public override int ReadTimeout {
public int ReadTimeout {
get { return Impl.ReadTimeout; }
set { Impl.ReadTimeout = value; }
}
public override int WriteTimeout {
public int WriteTimeout {
get { return Impl.WriteTimeout; }
set { Impl.WriteTimeout = value; }
}
public override bool CheckCertRevocationStatus {
public bool CheckCertRevocationStatus {
get { return Impl.CheckCertRevocationStatus; }
}
public override X509Certificate InternalLocalCertificate {
public X509Certificate InternalLocalCertificate {
get {
try {
return LocalCertificate;
@@ -270,25 +272,40 @@ namespace Mono.Security.Providers.DotNet
}
}
public override X509Certificate LocalCertificate {
public X509Certificate LocalCertificate {
get { return Impl.LocalCertificate; }
}
public override X509Certificate RemoteCertificate {
public X509Certificate RemoteCertificate {
get { return Impl.RemoteCertificate; }
}
public override SslProtocols SslProtocol {
public SslProtocols SslProtocol {
get { return Impl.SslProtocol; }
}
MSI.MonoTlsProvider MSI.IMonoSslStream.Provider {
get { return provider; }
}
MSI.MonoTlsConnectionInfo MSI.IMonoSslStream.GetConnectionInfo ()
{
return null;
}
void CheckDisposed ()
{
if (impl == null)
throw new ObjectDisposedException ("MonoSslStream");
}
protected override void Dispose (bool disposing)
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected void Dispose (bool disposing)
{
if (impl != null && disposing) {
impl.Dispose ();
@@ -40,15 +40,29 @@ namespace Mono.Security.Providers.DotNet
*/
public class DotNetTlsProvider : MonoTlsProvider
{
static readonly Guid id = new Guid ("3a7b3a26-0dbd-4572-a5b8-fdce766bf0dd");
public override Guid ID {
get { return id; }
}
public override string Name {
get { return "dotnet"; }
}
public override bool SupportsSslStream {
get { return true; }
}
public override bool SupportsConnectionInfo {
get { return false; }
}
public override bool SupportsMonoExtensions {
get { return false; }
}
public override bool SupportsTlsContext {
internal override bool SupportsTlsContext {
get { return false; }
}
@@ -56,7 +70,7 @@ namespace Mono.Security.Providers.DotNet
get { return (SslProtocols)ServicePointManager.SecurityProtocol; }
}
public override MonoSslStream CreateSslStream (
public override IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
@@ -71,10 +85,10 @@ namespace Mono.Security.Providers.DotNet
selection_callback = ConvertCallback (settings.ClientCertificateSelectionCallback);
}
return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, validation_callback, selection_callback);
return new DotNetSslStreamImpl (innerStream, leaveInnerStreamOpen, this, validation_callback, selection_callback);
}
public override IMonoTlsContext CreateTlsContext (
internal override IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, TlsProtocols protocolFlags,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
@@ -18,3 +18,4 @@ EXTRA_DISTFILES = README.md
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -30,3 +30,4 @@
../System/Mono.Net.Security/IMonoTlsProvider.cs
../System/Mono.Net.Security/MonoTlsProviderFactory.cs
../System/Mono.Net.Security/MonoTlsProviderWrapper.cs
@@ -45,3 +45,4 @@ using System.Runtime.InteropServices;
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
@@ -0,0 +1,12 @@
thisdir = class/Mono.Security.Providers.NewTls
SUBDIRS =
include ../../build/rules.make
LIBRARY = Mono.Security.Providers.NewTls.dll
LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:System.dll \
-r:NewSystemSource=Mono.Security.Providers.NewSystemSource.dll -r:Mono.Security.dll
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -0,0 +1,13 @@
./Properties/AssemblyInfo.cs
../../build/common/SR.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Security.Providers.NewTls/ITlsConfiguration.cs
./Mono.Security.Providers.NewTls/ITlsContext.cs
./Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
./Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
./Mono.Security.Providers.NewTls/NewTlsProvider.cs
./Mono.Security.Providers.NewTls/TlsContextWrapper.cs
./Mono.Security.Providers.NewTls/TlsProviderFactory.cs
@@ -0,0 +1,47 @@
//
// ITlsContext.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015-2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Security.Cryptography;
using Mono.Security.Interface;
using MX = Mono.Security.X509;
namespace Mono.Security.Providers.NewTls
{
interface ITlsConfiguration
{
bool HasCredentials {
get;
}
void SetCertificate (MX.X509Certificate certificate, AsymmetricAlgorithm privateKey);
bool? AskForClientCertificate {
get; set;
}
}
}
@@ -0,0 +1,70 @@
//
// ITlsContext.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015-2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
extern alias NewSystemSource;
using System;
using System.Security.Cryptography;
using Mono.Security.Interface;
using MX = Mono.Security.X509;
namespace Mono.Security.Providers.NewTls
{
interface ITlsContext : IDisposable
{
bool IsValid {
get;
}
TlsException LastError {
get;
}
bool ReceivedCloseNotify {
get;
}
MonoTlsConnectionInfo ConnectionInfo {
get;
}
MX.X509Certificate GetRemoteCertificate (out MX.X509CertificateCollection remoteCertificateStore);
bool VerifyRemoteCertificate ();
int GenerateNextToken (TlsBuffer incoming, TlsMultiBuffer outgoing);
int DecryptMessage (ref TlsBuffer incoming);
int EncryptMessage (ref TlsBuffer incoming);
byte[] CreateAlert (Alert alert);
byte[] CreateHelloRequest ();
}
}
@@ -0,0 +1,93 @@
//
// MonoNewTlsStream.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
extern alias NewSystemSource;
using EncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
using LocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
using RemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
using SslStream = NewSystemSource::System.Net.Security.SslStream;
using System;
using System.IO;
using System.Threading.Tasks;
using MSI = Mono.Security.Interface;
using XAuthenticatedStream = System.Net.Security.AuthenticatedStream;
using System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
public class MonoNewTlsStream : SslStream, MSI.IMonoSslStream
{
MSI.MonoTlsProvider provider;
internal MonoNewTlsStream (Stream innerStream, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
: this (innerStream, false, provider, settings)
{
}
internal MonoNewTlsStream (Stream innerStream, bool leaveOpen, MSI.MonoTlsProvider provider, MSI.MonoTlsSettings settings)
: base (innerStream, leaveOpen, EncryptionPolicy.RequireEncryption, provider, settings)
{
this.provider = provider;
}
public MSI.MonoTlsProvider Provider {
get { return provider; }
}
new public bool IsClosed {
get { return base.IsClosed; }
}
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
{
return GetMonoConnectionInfo ();
}
public Task Shutdown ()
{
return Task.Factory.FromAsync ((state, result) => BeginShutdown (state, result), EndShutdown, null);
}
public Task RequestRenegotiation ()
{
return Task.Factory.FromAsync ((state, result) => BeginRenegotiate (state, result), EndRenegotiate, null);
}
X509Certificate MSI.IMonoSslStream.InternalLocalCertificate {
get { return InternalLocalCertificate; }
}
XAuthenticatedStream MSI.IMonoSslStream.AuthenticatedStream {
get { return this; }
}
}
}
@@ -0,0 +1,91 @@
//
// MonoNewTlsStreamFactory.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
extern alias NewSystemSource;
using XEncryptionPolicy = NewSystemSource::System.Net.Security.EncryptionPolicy;
using XSslPolicyErrors = NewSystemSource::System.Net.Security.SslPolicyErrors;
using XLocalCertificateSelectionCallback = NewSystemSource::System.Net.Security.LocalCertificateSelectionCallback;
using XRemoteCertificateValidationCallback = NewSystemSource::System.Net.Security.RemoteCertificateValidationCallback;
using System;
using System.IO;
using System.Net.Security;
using System.Security.Authentication;
using Mono.Security.Interface;
using PSSCX = System.Security.Cryptography.X509Certificates;
using SSCX = System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
public static class MonoNewTlsStreamFactory
{
internal static IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsProvider provider, MonoTlsSettings settings = null)
{
return new MonoNewTlsStream (innerStream, leaveInnerStreamOpen, provider, settings);
}
public static MonoNewTlsStream CreateServer (
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
SSCX.X509Certificate serverCertificate, bool clientCertificateRequired,
SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
try {
stream.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
} catch (Exception ex) {
var tlsEx = stream.LastError;
if (tlsEx != null)
throw new AggregateException (ex, tlsEx);
throw;
}
return stream;
}
public static MonoNewTlsStream CreateClient (
Stream innerStream, bool leaveOpen, MonoTlsProvider provider, MonoTlsSettings settings,
string targetHost, PSSCX.X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
var stream = new MonoNewTlsStream (innerStream, leaveOpen, provider, settings);
try {
stream.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
} catch (Exception ex) {
var tlsEx = stream.LastError;
if (tlsEx != null)
throw new AggregateException (ex, tlsEx);
throw;
}
return stream;
}
}
}
@@ -0,0 +1,95 @@
//
// NewTlsProvider.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
extern alias NewSystemSource;
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using MSI = Mono.Security.Interface;
using MX = Mono.Security.X509;
using PSSCX = System.Security.Cryptography.X509Certificates;
using SSCX = System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
public class NewTlsProvider : MSI.MonoTlsProvider
{
static readonly Guid id = new Guid ("e5ff34f1-8b7a-4aa6-aff9-24719d709693");
public override Guid ID {
get { return id; }
}
public override string Name {
get { return "newtls"; }
}
public override bool SupportsSslStream {
get { return true; }
}
public override bool SupportsConnectionInfo {
get { return true; }
}
public override bool SupportsMonoExtensions {
get { return true; }
}
internal override bool SupportsTlsContext {
get { return true; }
}
public override SslProtocols SupportedProtocols {
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
}
public override MSI.IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MSI.MonoTlsSettings settings = null)
{
return MonoNewTlsStreamFactory.CreateSslStream (innerStream, leaveInnerStreamOpen, this, settings);
}
internal override MSI.IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
SSCX.X509Certificate serverCertificate, PSSCX.X509CertificateCollection clientCertificates,
bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
MSI.MonoTlsSettings settings)
{
var config = TlsProviderFactory.CreateTlsConfiguration (
hostname, serverMode, protocolFlags, serverCertificate,
remoteCertRequired, settings);
return new TlsContextWrapper (config, serverMode);
}
}
}
@@ -0,0 +1,221 @@
//
// TlsContextWrapper.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
extern alias NewSystemSource;
using System;
using System.Security.Cryptography;
using SSCX = System.Security.Cryptography.X509Certificates;
using PSSCX = System.Security.Cryptography.X509Certificates;
using MSI = Mono.Security.Interface;
using MX = Mono.Security.X509;
namespace Mono.Security.Providers.NewTls
{
class TlsContextWrapper : IDisposable, MSI.IMonoTlsContext
{
ITlsConfiguration config;
ITlsContext context;
bool serverMode;
public TlsContextWrapper (ITlsConfiguration config, bool serverMode)
{
this.config = config;
this.serverMode = serverMode;
}
public bool IsServer {
get { return serverMode; }
}
public bool IsValid {
get { return context != null && context.IsValid; }
}
public void Initialize (MSI.IMonoTlsEventSink eventSink)
{
if (context != null)
throw new InvalidOperationException ();
context = TlsProviderFactory.CreateTlsContext (config, serverMode, eventSink);
}
void Clear ()
{
if (context != null) {
context.Dispose ();
context = null;
}
}
public ITlsConfiguration Configuration {
get {
if (config == null)
throw new ObjectDisposedException ("TlsConfiguration");
return config;
}
}
public ITlsContext Context {
get {
if (!IsValid)
throw new ObjectDisposedException ("TlsContext");
return context;
}
}
public bool HasCredentials {
get { return Configuration.HasCredentials; }
}
public void SetCertificate (SSCX.X509Certificate certificate, AsymmetricAlgorithm privateKey)
{
var monoCert = new MX.X509Certificate (certificate.GetRawCertData ());
Configuration.SetCertificate (monoCert, privateKey);
}
public int GenerateNextToken (MSI.IBufferOffsetSize incoming, out MSI.IBufferOffsetSize outgoing)
{
var input = incoming != null ? new MSI.TlsBuffer (BOSWrapper.Wrap (incoming)) : null;
var output = new MSI.TlsMultiBuffer ();
var retval = Context.GenerateNextToken (input, output);
if (output.IsEmpty)
outgoing = null;
outgoing = BOSWrapper.Wrap (output.StealBuffer ());
return (int)retval;
}
public int EncryptMessage (ref MSI.IBufferOffsetSize incoming)
{
var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
var retval = Context.EncryptMessage (ref buffer);
incoming = BOSWrapper.Wrap (buffer.GetRemaining ());
return (int)retval;
}
public int DecryptMessage (ref MSI.IBufferOffsetSize incoming)
{
var buffer = new MSI.TlsBuffer (BOSWrapper.Wrap (incoming));
var retval = Context.DecryptMessage (ref buffer);
incoming = buffer != null ? BOSWrapper.Wrap (buffer.GetRemaining ()) : null;
return (int)retval;
}
class BOSWrapper : MSI.IBufferOffsetSize
{
public byte[] Buffer {
get;
private set;
}
public int Offset {
get;
private set;
}
public int Size {
get;
private set;
}
BOSWrapper (byte[] buffer, int offset, int size)
{
Buffer = buffer;
Offset = offset;
Size = size;
}
public static BOSWrapper Wrap (MSI.IBufferOffsetSize bos)
{
return bos != null ? new BOSWrapper (bos.Buffer, bos.Offset, bos.Size) : null;
}
}
public byte[] CreateCloseNotify ()
{
return Context.CreateAlert (new MSI.Alert (MSI.AlertLevel.Warning, MSI.AlertDescription.CloseNotify));
}
public byte[] CreateHelloRequest ()
{
return Context.CreateHelloRequest ();
}
public SSCX.X509Certificate GetRemoteCertificate (out PSSCX.X509CertificateCollection remoteCertificateStore)
{
MX.X509CertificateCollection monoCollection;
var remoteCert = Context.GetRemoteCertificate (out monoCollection);
if (remoteCert == null) {
remoteCertificateStore = null;
return null;
}
remoteCertificateStore = new PSSCX.X509CertificateCollection ();
foreach (var cert in monoCollection) {
remoteCertificateStore.Add (new PSSCX.X509Certificate2 (cert.RawData));
}
return new PSSCX.X509Certificate2 (remoteCert.RawData);
}
public bool VerifyRemoteCertificate ()
{
return Context.VerifyRemoteCertificate ();
}
public Exception LastError {
get {
if (context != null)
return context.LastError;
return null;
}
}
public bool ReceivedCloseNotify {
get {
return Context.ReceivedCloseNotify;
}
}
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
{
return Context.ConnectionInfo;
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
void Dispose (bool disposing)
{
Clear ();
}
}
}
@@ -0,0 +1,97 @@
//
// TlsProviderFactory.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015-2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
extern alias NewSystemSource;
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using MSI = Mono.Security.Interface;
using MX = Mono.Security.X509;
using PSSCX = System.Security.Cryptography.X509Certificates;
using SSCX = System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Providers.NewTls
{
static class TlsProviderFactory
{
const string assemblyName = "Mono.Security.NewTls, Version=4.0.0.0, Culture=neutral, PublicKeyToken=84e3aee7225169c2";
const string tlsConfigTypeName = "Mono.Security.NewTls.TlsConfiguration";
const string tlsContextTypeName = "Mono.Security.NewTls.TlsContext";
static object CreateInstance (string typeName, object[] args)
{
var type = Type.GetType (typeName + ", " + assemblyName);
return Activator.CreateInstance (type, args);
}
internal static ITlsConfiguration CreateTlsConfiguration (
string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
SSCX.X509Certificate serverCertificate, bool remoteCertRequired,
MSI.MonoTlsSettings settings)
{
object[] args;
ITlsConfiguration config;
if (serverMode) {
var cert = (PSSCX.X509Certificate2)serverCertificate;
var monoCert = new MX.X509Certificate (cert.RawData);
args = new object[] {
(MSI.TlsProtocols)protocolFlags,
(MSI.MonoTlsSettings)settings,
monoCert,
cert.PrivateKey
};
} else {
args = new object[] {
(MSI.TlsProtocols)protocolFlags,
(MSI.MonoTlsSettings)settings,
hostname
};
}
config = (ITlsConfiguration)CreateInstance (tlsConfigTypeName, args);
if (serverMode && remoteCertRequired)
config.AskForClientCertificate = true;
return config;
}
internal static ITlsContext CreateTlsContext (
ITlsConfiguration config, bool serverMode,
MSI.IMonoTlsEventSink eventSink)
{
return (ITlsContext)CreateInstance (
tlsContextTypeName,
new object[] { config, serverMode, eventSink });
}
}
}
@@ -0,0 +1,47 @@
//
// AssemblyInfo.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Reflection;
using System.Resources;
using System.Security;
using System.Security.Permissions;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about the system assembly
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyCompany ("Xamarin")]
[assembly: AssemblyCopyright ("(c) 2015 Xamarin")]
[assembly: AssemblyDescription ("Mono.Security.Providers.NewTls.dll")]
[assembly: AssemblyProduct ("MONO CLI")]
[assembly: AssemblyTitle ("Mono.Security.Providers.NewTls.dll")]
[assembly: CLSCompliant (false)]
[assembly: ComVisible (false)]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: InternalsVisibleTo ("Mono.Security.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000003336d6aed41624ca156ab579881fe90a576f1dfec48378fc94e4e440f4556776224e2d70c18996d91f36227f539fdb44340e07651f1455a489b29a7e6219a8f85e52b0f8588b4f8a857746a8468d37b556223d1452f3fcbaf0f269cdf1900ceb68f69485dc5887750d19571030c732331e00387d9b813a9ad52891087301793")]
@@ -0,0 +1,7 @@
Properties/AssemblyInfo.cs
Mono.Security.Providers.NewTls/ITlsConfiguration.cs
Mono.Security.Providers.NewTls/ITlsContext.cs
Mono.Security.Providers.NewTls/MonoNewTlsStream.cs
Mono.Security.Providers.NewTls/MonoNewTlsStreamFactory.cs
@@ -0,0 +1 @@
#include mobile_Mono.Security.Providers.NewTls.dll.sources
@@ -8,3 +8,5 @@ LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -d:SECURITY
include ../../build/library.make
$(the_lib): ../Mono.Security/Makefile
@@ -30,12 +30,22 @@ using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Interface;
using Mono.Net.Security;
using MNS = Mono.Net.Security;
namespace Mono.Security.Providers.OldTls
{
public class OldTlsProvider : MonoTlsProvider
{
static readonly Guid id = new Guid ("cf8baa0d-c6ed-40ae-b512-dec8d097e9af");
public override Guid ID {
get { return id; }
}
public override string Name {
get { return "old"; }
}
public override bool SupportsSslStream {
get { return true; }
}
@@ -44,7 +54,11 @@ namespace Mono.Security.Providers.OldTls
get { return false; }
}
public override bool SupportsTlsContext {
public override bool SupportsConnectionInfo {
get { return false; }
}
internal override bool SupportsTlsContext {
get { return false; }
}
@@ -52,15 +66,15 @@ namespace Mono.Security.Providers.OldTls
get { return SslProtocols.Tls; }
}
public override MonoSslStream CreateSslStream (
public override IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null)
{
var impl = new LegacySslStream (innerStream, leaveInnerStreamOpen, settings);
return new MonoSslStreamImpl (impl);
var impl = new MNS.Private.LegacySslStream (innerStream, leaveInnerStreamOpen, this, settings);
return new MNS.Private.MonoSslStreamImpl (impl);
}
public override IMonoTlsContext CreateTlsContext (
internal override IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, TlsProtocols protocolFlags,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
@@ -60,6 +60,13 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../mono.pub")]
#if MOBILE
#if NET_2_1
[assembly: InternalsVisibleTo ("System, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
#else
[assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
#endif
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
[assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
+6 -1
View File
@@ -5,7 +5,7 @@ include ../../build/rules.make
LIBRARY = Mono.Security.dll
LOCAL_MCS_FLAGS = -lib:$(the_libdir_base)bare
LIB_REFS = System
LIB_MCS_FLAGS = -unsafe -nowarn:1030
LIB_MCS_FLAGS = -unsafe -nowarn:1030,3009
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:169,219,618,672
include ../../build/library.make
@@ -18,3 +18,8 @@ $(the_libdir_base)bare/System.dll:
.NOTPARALLEL: $(the_libdir_base)bare/System.dll
EXTRA_DISTFILES = Mono.Security.Interface/README.md
#
# Update this comment to trigger a build in System
# +2
#
@@ -77,7 +77,7 @@ namespace Mono.Security.Authenticode {
public string Hash {
get {
if (hash == null)
hash = "MD5";
hash = "SHA1";
return hash;
}
set {
@@ -0,0 +1,277 @@
//
// Alert.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
#region Enumerations
public enum AlertLevel : byte
{
Warning = 1,
Fatal = 2
}
public enum AlertDescription : byte
{
CloseNotify = 0,
UnexpectedMessage = 10,
BadRecordMAC = 20,
DecryptionFailed_RESERVED = 21,
RecordOverflow = 22,
DecompressionFailure = 30,
HandshakeFailure = 40,
NoCertificate_RESERVED = 41, // should be used in SSL3
BadCertificate = 42,
UnsupportedCertificate = 43,
CertificateRevoked = 44,
CertificateExpired = 45,
CertificateUnknown = 46,
IlegalParameter = 47,
UnknownCA = 48,
AccessDenied = 49,
DecodeError = 50,
DecryptError = 51,
ExportRestriction = 60,
ProtocolVersion = 70,
InsuficientSecurity = 71,
InternalError = 80,
UserCancelled = 90,
NoRenegotiation = 100,
UnsupportedExtension = 110
}
#endregion
public class Alert
{
#region Fields
private AlertLevel level;
private AlertDescription description;
#endregion
#region Properties
public AlertLevel Level
{
get { return this.level; }
}
public AlertDescription Description
{
get { return this.description; }
}
public string Message
{
get { return Alert.GetAlertMessage(this.description); }
}
public bool IsWarning
{
get { return this.level == AlertLevel.Warning ? true : false; }
}
/*
public bool IsFatal
{
get { return this.level == AlertLevel.Fatal ? true : false; }
}
*/
public bool IsCloseNotify
{
get
{
if (this.IsWarning &&
this.description == AlertDescription.CloseNotify)
{
return true;
}
return false;
}
}
#endregion
#region Constructors
public Alert(AlertDescription description)
{
this.description = description;
this.inferAlertLevel();
}
public Alert(
AlertLevel level,
AlertDescription description)
{
this.level = level;
this.description = description;
}
#endregion
#region Private Methods
private void inferAlertLevel()
{
switch (description)
{
case AlertDescription.CloseNotify:
case AlertDescription.NoRenegotiation:
case AlertDescription.UserCancelled:
this.level = AlertLevel.Warning;
break;
case AlertDescription.AccessDenied:
case AlertDescription.BadCertificate:
case AlertDescription.BadRecordMAC:
case AlertDescription.CertificateExpired:
case AlertDescription.CertificateRevoked:
case AlertDescription.CertificateUnknown:
case AlertDescription.DecodeError:
case AlertDescription.DecompressionFailure:
case AlertDescription.DecryptError:
case AlertDescription.DecryptionFailed_RESERVED:
case AlertDescription.ExportRestriction:
case AlertDescription.HandshakeFailure:
case AlertDescription.IlegalParameter:
case AlertDescription.InsuficientSecurity:
case AlertDescription.InternalError:
case AlertDescription.ProtocolVersion:
case AlertDescription.RecordOverflow:
case AlertDescription.UnexpectedMessage:
case AlertDescription.UnknownCA:
case AlertDescription.UnsupportedCertificate:
case AlertDescription.UnsupportedExtension:
default:
this.level = AlertLevel.Fatal;
break;
}
}
#endregion
public override string ToString ()
{
return string.Format ("[Alert: {0}:{1}]", Level, Description);
}
#region Static Methods
public static string GetAlertMessage(AlertDescription description)
{
#if (DEBUG)
switch (description)
{
case AlertDescription.AccessDenied:
return "An inappropriate message was received.";
case AlertDescription.BadCertificate:
return "TLSCiphertext decrypted in an invalid way.";
case AlertDescription.BadRecordMAC:
return "Record with an incorrect MAC.";
case AlertDescription.CertificateExpired:
return "Certificate has expired or is not currently valid";
case AlertDescription.CertificateRevoked:
return "Certificate was revoked by its signer.";
case AlertDescription.CertificateUnknown:
return "Certificate Unknown.";
case AlertDescription.CloseNotify:
return "Connection closed";
case AlertDescription.DecodeError:
return "A message could not be decoded because some field was out of the specified range or the length of the message was incorrect.";
case AlertDescription.DecompressionFailure:
return "The decompression function received improper input (e.g. data that would expand to excessive length).";
case AlertDescription.DecryptError:
return "TLSCiphertext decrypted in an invalid way: either it wasn`t an even multiple of the block length or its padding values, when checked, weren`t correct.";
case AlertDescription.DecryptionFailed_RESERVED:
return "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message.";
case AlertDescription.ExportRestriction:
return "Negotiation not in compliance with export restrictions was detected.";
case AlertDescription.HandshakeFailure:
return "Unable to negotiate an acceptable set of security parameters given the options available.";
case AlertDescription.IlegalParameter:
return "A field in the handshake was out of range or inconsistent with other fields.";
case AlertDescription.InsuficientSecurity:
return "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client.";
case AlertDescription.InternalError:
return "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue.";
case AlertDescription.NoRenegotiation:
return "Invalid renegotiation.";
case AlertDescription.ProtocolVersion:
return "Unsupported protocol version.";
case AlertDescription.RecordOverflow:
return "Invalid length on TLSCiphertext record or TLSCompressed record.";
case AlertDescription.UnexpectedMessage:
return "Invalid message received.";
case AlertDescription.UnknownCA:
return "CA can't be identified as a trusted CA.";
case AlertDescription.UnsupportedCertificate:
return "Certificate was of an unsupported type.";
case AlertDescription.UserCancelled:
return "Handshake cancelled by user.";
case AlertDescription.UnsupportedExtension:
return "Unsupported extension.";
default:
return "";
}
#else
return "The authentication or decryption has failed.";
#endif
}
#endregion
}
}
@@ -0,0 +1,96 @@
//
// BufferOffsetSize.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
public class BufferOffsetSize : SecretParameters, IBufferOffsetSize
{
public byte[] Buffer {
get;
private set;
}
public int Offset {
get;
internal set;
}
public int Size {
get { return EndOffset - Offset; }
}
public int EndOffset {
get;
internal set;
}
public BufferOffsetSize (byte[] buffer, int offset, int size)
{
Buffer = buffer;
Offset = offset;
EndOffset = offset + size;
}
public BufferOffsetSize (byte[] buffer)
: this (buffer, 0, buffer.Length)
{
}
public BufferOffsetSize (int size)
: this (new byte [size])
{
}
public byte[] GetBuffer ()
{
var copy = new byte [Size];
Array.Copy (Buffer, Offset, copy, 0, Size);
return copy;
}
public void TruncateTo (int newSize)
{
if (newSize > Size)
throw new ArgumentException ("newSize");
EndOffset = Offset + newSize;
}
protected void SetBuffer (byte[] buffer, int offset, int size)
{
Buffer = buffer;
Offset = offset;
EndOffset = offset + size;
}
protected override void Clear ()
{
Buffer = null;
Offset = EndOffset = 0;
}
}
}
@@ -36,7 +36,6 @@ using Mono.Net.Security;
namespace Mono.Security.Interface
{
#if (!MONOTOUCH && !MONODROID) || INSIDE_SYSTEM
public class ValidationResult
{
bool trusted;
@@ -52,12 +51,11 @@ namespace Mono.Security.Interface
this.policy_errors = policy_errors;
}
internal ValidationResult (bool trusted, bool user_defined, int error_code)
internal ValidationResult (bool trusted, bool user_denied, int error_code)
{
this.trusted = trusted;
this.user_denied = user_denied;
this.error_code = error_code;
this.policy_errors = policy_errors;
}
public bool Trusted {
@@ -86,13 +84,24 @@ namespace Mono.Security.Interface
get;
}
X509Certificate SelectClientCertificate (
/*
* Returns `true` if a client certificate has been selected (which could be `null`).
*/
bool SelectClientCertificate (
string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate,
string[] acceptableIssuers);
string[] acceptableIssuers, out X509Certificate clientCertificate);
ValidationResult ValidateChain (string targetHost, X509CertificateCollection certificates);
/*
* If @serverMode is true, then we're a server and want to validate a certificate that we received from a client.
*/
ValidationResult ValidateCertificate (string targetHost, bool serverMode, X509CertificateCollection certificates);
ValidationResult ValidateClientCertificate (X509CertificateCollection certificates);
/*
* On OS X and Mobile, the @chain will be initialized with the @certificates, but not actually built.
*/
bool InvokeSystemValidator (
string targetHost, bool serverMode, X509CertificateCollection certificates,
X509Chain chain, ref MonoSslPolicyErrors errors, ref int status11);
}
public static class CertificateValidationHelper
@@ -128,15 +137,25 @@ namespace Mono.Security.Interface
get { return supportsTrustAnchors; }
}
internal static ICertificateValidator GetDefaultValidator (MonoTlsSettings settings)
static ICertificateValidator GetDefaultValidator (MonoTlsProvider provider, MonoTlsSettings settings)
{
return (ICertificateValidator)NoReflectionHelper.GetDefaultCertificateValidator (settings);
return (ICertificateValidator)NoReflectionHelper.GetDefaultCertificateValidator (provider, settings);
}
/*
* Internal API, intended to be used by MonoTlsProvider implementations.
*/
public static ICertificateValidator GetValidator (MonoTlsProvider provider, MonoTlsSettings settings)
{
return GetDefaultValidator (provider, settings);
}
/*
* Use this overloaded version in user code.
*/
public static ICertificateValidator GetValidator (MonoTlsSettings settings)
{
return GetDefaultValidator (settings);
return GetDefaultValidator (null, settings);
}
}
#endif
}
@@ -1,16 +1,21 @@
//
//
// CipherAlgorithmType.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -18,24 +23,17 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.IO.Compression.dll")]
[assembly: AssemblyDescription ("System.IO.Compression.dll")]
[assembly: AssemblyDefaultAlias ("System.IO.Compression.dll")]
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.0.0.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
[assembly: ReferenceAssembly]
namespace Mono.Security.Interface
{
public enum CipherAlgorithmType
{
None,
Aes128,
Aes256,
AesGcm128,
AesGcm256
}
}
@@ -0,0 +1,398 @@
//
// CipherSuiteCode.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
/// <summary>
/// RFC 2246 A.5
/// </summary>
public enum CipherSuiteCode : ushort
{
TLS_NULL_WITH_NULL_NULL = 0x0000,
TLS_RSA_WITH_NULL_MD5 = 0x0001,
TLS_RSA_WITH_NULL_SHA = 0x0002,
TLS_RSA_EXPORT_WITH_RC4_40_MD5 = 0x0003,
TLS_RSA_WITH_RC4_128_MD5 = 0x0004,
TLS_RSA_WITH_RC4_128_SHA = 0x0005,
TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x0006,
TLS_RSA_WITH_IDEA_CBC_SHA = 0x0007,
TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0008,
TLS_RSA_WITH_DES_CBC_SHA = 0x0009,
TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A,
TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x000B,
TLS_DH_DSS_WITH_DES_CBC_SHA = 0x000C,
TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x000D,
TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x000E,
TLS_DH_RSA_WITH_DES_CBC_SHA = 0x000F,
TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x0010,
TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0011,
TLS_DHE_DSS_WITH_DES_CBC_SHA = 0x0012,
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x0013,
TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0014,
TLS_DHE_RSA_WITH_DES_CBC_SHA = 0x0015,
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016,
TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x0017,
TLS_DH_anon_WITH_RC4_128_MD5 = 0x0018,
TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x0019,
TLS_DH_anon_WITH_DES_CBC_SHA = 0x001A,
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x001B,
/*
* Note: The cipher suite values { 0x00, 0x1C } and { 0x00, 0x1D } are reserved to avoid
* collision with Fortezza-based cipher suites in SSL 3.
*/
/*
* RFC 3268
*/
TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F,
TLS_DH_DSS_WITH_AES_128_CBC_SHA = 0x0030,
TLS_DH_RSA_WITH_AES_128_CBC_SHA = 0x0031,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033,
TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034,
TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035,
TLS_DH_DSS_WITH_AES_256_CBC_SHA = 0x0036,
TLS_DH_RSA_WITH_AES_256_CBC_SHA = 0x0037,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x0038,
TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039,
TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x003A,
/*
* RFC 5932
*/
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x0041,
TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA = 0x0042,
TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x0043,
TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA = 0x0044,
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x0045,
TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA = 0x0046,
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x0084,
TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA = 0x0085,
TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x0086,
TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA = 0x0087,
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x0088,
TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA = 0x0089,
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BA,
TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BB,
TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BC,
TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BD,
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BE,
TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256 = 0x00BF,
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C0,
TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C1,
TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C2,
TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C3,
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C4,
TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256 = 0x00C5,
/*
* RFC 4162
*/
TLS_RSA_WITH_SEED_CBC_SHA = 0x0096,
TLS_DH_DSS_WITH_SEED_CBC_SHA = 0x0097,
TLS_DH_RSA_WITH_SEED_CBC_SHA = 0x0098,
TLS_DHE_DSS_WITH_SEED_CBC_SHA = 0x0099,
TLS_DHE_RSA_WITH_SEED_CBC_SHA = 0x009A,
TLS_DH_anon_WITH_SEED_CBC_SHA = 0x009B,
/*
* RFC 4279
*/
TLS_PSK_WITH_RC4_128_SHA = 0x008A,
TLS_PSK_WITH_3DES_EDE_CBC_SHA = 0x008B,
TLS_PSK_WITH_AES_128_CBC_SHA = 0x008C,
TLS_PSK_WITH_AES_256_CBC_SHA = 0x008D,
TLS_DHE_PSK_WITH_RC4_128_SHA = 0x008E,
TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA = 0x008F,
TLS_DHE_PSK_WITH_AES_128_CBC_SHA = 0x0090,
TLS_DHE_PSK_WITH_AES_256_CBC_SHA = 0x0091,
TLS_RSA_PSK_WITH_RC4_128_SHA = 0x0092,
TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA = 0x0093,
TLS_RSA_PSK_WITH_AES_128_CBC_SHA = 0x0094,
TLS_RSA_PSK_WITH_AES_256_CBC_SHA = 0x0095,
/*
* RFC 4492
*/
TLS_ECDH_ECDSA_WITH_NULL_SHA = 0xC001,
TLS_ECDH_ECDSA_WITH_RC4_128_SHA = 0xC002,
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC003,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = 0xC004,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005,
TLS_ECDHE_ECDSA_WITH_NULL_SHA = 0xC006,
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = 0xC007,
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC008,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A,
TLS_ECDH_RSA_WITH_NULL_SHA = 0xC00B,
TLS_ECDH_RSA_WITH_RC4_128_SHA = 0xC00C,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = 0xC00D,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = 0xC00E,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = 0xC00F,
TLS_ECDHE_RSA_WITH_NULL_SHA = 0xC010,
TLS_ECDHE_RSA_WITH_RC4_128_SHA = 0xC011,
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = 0xC012,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014,
TLS_ECDH_anon_WITH_NULL_SHA = 0xC015,
TLS_ECDH_anon_WITH_RC4_128_SHA = 0xC016,
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA = 0xC017,
TLS_ECDH_anon_WITH_AES_128_CBC_SHA = 0xC018,
TLS_ECDH_anon_WITH_AES_256_CBC_SHA = 0xC019,
/*
* RFC 4785
*/
TLS_PSK_WITH_NULL_SHA = 0x002C,
TLS_DHE_PSK_WITH_NULL_SHA = 0x002D,
TLS_RSA_PSK_WITH_NULL_SHA = 0x002E,
/*
* RFC 5054
*/
TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA = 0xC01A,
TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA = 0xC01B,
TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA = 0xC01C,
TLS_SRP_SHA_WITH_AES_128_CBC_SHA = 0xC01D,
TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA = 0xC01E,
TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA = 0xC01F,
TLS_SRP_SHA_WITH_AES_256_CBC_SHA = 0xC020,
TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA = 0xC021,
TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA = 0xC022,
/*
* RFC 5246
*/
TLS_RSA_WITH_NULL_SHA256 = 0x003B,
TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x003C,
TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003D,
TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 0x003E,
TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 0x003F,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x0040,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x0067,
TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 0x0068,
TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 0x0069,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x006A,
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x006B,
TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x006C,
TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x006D,
/*
* RFC 5288
*/
TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009C,
TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009D,
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 0x009E,
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 0x009F,
TLS_DH_RSA_WITH_AES_128_GCM_SHA256 = 0x00A0,
TLS_DH_RSA_WITH_AES_256_GCM_SHA384 = 0x00A1,
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 = 0x00A2,
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 = 0x00A3,
TLS_DH_DSS_WITH_AES_128_GCM_SHA256 = 0x00A4,
TLS_DH_DSS_WITH_AES_256_GCM_SHA384 = 0x00A5,
TLS_DH_anon_WITH_AES_128_GCM_SHA256 = 0x00A6,
TLS_DH_anon_WITH_AES_256_GCM_SHA384 = 0x00A7,
/*
* RFC 5289
*/
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC023,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC024,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC025,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC026,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xC027,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xC028,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = 0xC029,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = 0xC02A,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02B,
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02C,
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02D,
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02E,
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xC02F,
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0xC030,
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = 0xC031,
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = 0xC032,
/*
* RFC 5487
*/
TLS_PSK_WITH_AES_128_GCM_SHA256 = 0x00A8,
TLS_PSK_WITH_AES_256_GCM_SHA384 = 0x00A9,
TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 = 0x00AA,
TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 = 0x00AB,
TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 = 0x00AC,
TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 = 0x00AD,
TLS_PSK_WITH_AES_128_CBC_SHA256 = 0x00AE,
TLS_PSK_WITH_AES_256_CBC_SHA384 = 0x00AF,
TLS_PSK_WITH_NULL_SHA256 = 0x00B0,
TLS_PSK_WITH_NULL_SHA384 = 0x00B1,
TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 = 0x00B2,
TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 = 0x00B3,
TLS_DHE_PSK_WITH_NULL_SHA256 = 0x00B4,
TLS_DHE_PSK_WITH_NULL_SHA384 = 0x00B5,
TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 = 0x00B6,
TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 = 0x00B7,
TLS_RSA_PSK_WITH_NULL_SHA256 = 0x00B8,
TLS_RSA_PSK_WITH_NULL_SHA384 = 0x00B9,
/*
* RFC 5489
*/
TLS_ECDHE_PSK_WITH_RC4_128_SHA = 0xC033,
TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA = 0xC034,
TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA = 0xC035,
TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA = 0xC036,
TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 = 0xC037,
TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 = 0xC038,
TLS_ECDHE_PSK_WITH_NULL_SHA = 0xC039,
TLS_ECDHE_PSK_WITH_NULL_SHA256 = 0xC03A,
TLS_ECDHE_PSK_WITH_NULL_SHA384 = 0xC03B,
/*
* RFC 5746
*/
TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 0x00FF,
/*
* RFC 6367
*/
TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC072,
TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC073,
TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC074,
TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC075,
TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC076,
TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC077,
TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xC078,
TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 = 0xC079,
TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC07A,
TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC07B,
TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC07C,
TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC07D,
TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC07E,
TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC07F,
TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256 = 0xC080,
TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384 = 0xC081,
TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256 = 0xC082,
TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384 = 0xC083,
TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256 = 0xC084,
TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384 = 0xC085,
TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC086,
TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC087,
TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC088,
TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC089,
TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC08A,
TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC08B,
TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 = 0xC08C,
TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 = 0xC08D,
TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 = 0xC08E,
TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 = 0xC08F,
TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 = 0xC090,
TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 = 0xC091,
TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 = 0xC092,
TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 = 0xC093,
TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC094,
TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC095,
TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC096,
TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC097,
TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC098,
TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC099,
TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 = 0xC09A,
TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 = 0xC09B,
/*
* RFC 6655
*/
TLS_RSA_WITH_AES_128_CCM = 0xC09C,
TLS_RSA_WITH_AES_256_CCM = 0xC09D,
TLS_DHE_RSA_WITH_AES_128_CCM = 0xC09E,
TLS_DHE_RSA_WITH_AES_256_CCM = 0xC09F,
TLS_RSA_WITH_AES_128_CCM_8 = 0xC0A0,
TLS_RSA_WITH_AES_256_CCM_8 = 0xC0A1,
TLS_DHE_RSA_WITH_AES_128_CCM_8 = 0xC0A2,
TLS_DHE_RSA_WITH_AES_256_CCM_8 = 0xC0A3,
TLS_PSK_WITH_AES_128_CCM = 0xC0A4,
TLS_PSK_WITH_AES_256_CCM = 0xC0A5,
TLS_DHE_PSK_WITH_AES_128_CCM = 0xC0A6,
TLS_DHE_PSK_WITH_AES_256_CCM = 0xC0A7,
TLS_PSK_WITH_AES_128_CCM_8 = 0xC0A8,
TLS_PSK_WITH_AES_256_CCM_8 = 0xC0A9,
TLS_PSK_DHE_WITH_AES_128_CCM_8 = 0xC0AA,
TLS_PSK_DHE_WITH_AES_256_CCM_8 = 0xC0AB,
/*
* draft-agl-tls-chacha20poly1305-04
*/
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCC13,
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCC14,
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCC15,
/*
* draft-josefsson-salsa20-tls-04
*/
TLS_RSA_WITH_ESTREAM_SALSA20_SHA1 = 0xE410,
TLS_RSA_WITH_SALSA20_SHA1 = 0xE411,
TLS_ECDHE_RSA_WITH_ESTREAM_SALSA20_SHA1 = 0xE412,
TLS_ECDHE_RSA_WITH_SALSA20_SHA1 = 0xE413,
TLS_ECDHE_ECDSA_WITH_ESTREAM_SALSA20_SHA1 = 0xE414,
TLS_ECDHE_ECDSA_WITH_SALSA20_SHA1 = 0xE415,
TLS_PSK_WITH_ESTREAM_SALSA20_SHA1 = 0xE416,
TLS_PSK_WITH_SALSA20_SHA1 = 0xE417,
TLS_ECDHE_PSK_WITH_ESTREAM_SALSA20_SHA1 = 0xE418,
TLS_ECDHE_PSK_WITH_SALSA20_SHA1 = 0xE419,
TLS_RSA_PSK_WITH_ESTREAM_SALSA20_SHA1 = 0xE41A,
TLS_RSA_PSK_WITH_SALSA20_SHA1 = 0xE41B,
TLS_DHE_PSK_WITH_ESTREAM_SALSA20_SHA1 = 0xE41C,
TLS_DHE_PSK_WITH_SALSA20_SHA1 = 0xE41D,
TLS_DHE_RSA_WITH_ESTREAM_SALSA20_SHA1 = 0xE41E,
TLS_DHE_RSA_WITH_SALSA20_SHA1 = 0xE41F,
/*
* draft-ietf-tls-downgrade-scsv-00
*/
TLS_FALLBACK_SCSV = 0x5600,
/*
public static bool IsScsv (int cipherSuite)
{
switch (cipherSuite) {
case TLS_EMPTY_RENEGOTIATION_INFO_SCSV:
case TLS_FALLBACK_SCSV:
return true,
default:
return false,
}
}
*/
}
}
@@ -1,16 +1,21 @@
//
//
// ExchangeAlgorithmType.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -18,14 +23,16 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.CompressionLevel))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.CompressionMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.DeflateStream))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.GZipStream))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipArchive))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipArchiveEntry))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipArchiveMode))]
using System;
namespace Mono.Security.Interface
{
public enum ExchangeAlgorithmType
{
None,
Dhe,
Rsa,
EcDhe
}
}
@@ -0,0 +1,44 @@
//
// HashAlgorithmType.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace Mono.Security.Interface
{
public enum HashAlgorithmType
{
// These values refer to the @HashAlgorithm enumeration in the TLS 1.2 spec.
None = 0,
Md5 = 1,
Sha1 = 2,
Sha224 = 3,
Sha256 = 4,
Sha384 = 5,
Sha512 = 6,
Unknown = 255,
// Mono-specific addition, allowing us to reuse it IHashAlgorithm API for TLS 1.0 / 1.1.
Md5Sha1 = 254
}
}
@@ -0,0 +1,195 @@
//
// IMonoSslStream.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Threading.Tasks;
using SSA = System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Security.Cryptography;
using Mono.Net.Security;
namespace Mono.Security.Interface
{
public interface IMonoSslStream : IDisposable
{
void AuthenticateAsClient (string targetHost);
void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState);
IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
void EndAuthenticateAsClient (IAsyncResult asyncResult);
void AuthenticateAsServer (X509Certificate serverCertificate);
void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState);
IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
void EndAuthenticateAsServer (IAsyncResult asyncResult);
Task AuthenticateAsClientAsync (string targetHost);
Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
Task AuthenticateAsServerAsync (X509Certificate serverCertificate);
Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
void Flush ();
int Read (byte[] buffer, int offset, int count);
void Write (byte[] buffer);
void Write (byte[] buffer, int offset, int count);
IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState);
int EndRead (IAsyncResult asyncResult);
IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState);
void EndWrite (IAsyncResult asyncResult);
TransportContext TransportContext {
get;
}
bool IsAuthenticated {
get;
}
bool IsMutuallyAuthenticated {
get;
}
bool IsEncrypted {
get;
}
bool IsSigned {
get;
}
bool IsServer {
get;
}
SSA.CipherAlgorithmType CipherAlgorithm {
get;
}
int CipherStrength {
get;
}
SSA.HashAlgorithmType HashAlgorithm {
get;
}
int HashStrength {
get;
}
SSA.ExchangeAlgorithmType KeyExchangeAlgorithm {
get;
}
int KeyExchangeStrength {
get;
}
bool CanRead {
get;
}
bool CanTimeout {
get;
}
bool CanWrite {
get;
}
long Length {
get;
}
long Position {
get;
}
void SetLength (long value);
AuthenticatedStream AuthenticatedStream {
get;
}
int ReadTimeout {
get; set;
}
int WriteTimeout {
get; set;
}
bool CheckCertRevocationStatus {
get;
}
X509Certificate InternalLocalCertificate {
get;
}
X509Certificate LocalCertificate {
get;
}
X509Certificate RemoteCertificate {
get;
}
SSA.SslProtocols SslProtocol {
get;
}
MonoTlsProvider Provider {
get;
}
MonoTlsConnectionInfo GetConnectionInfo ();
}
}
@@ -29,7 +29,7 @@ using System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Interface
{
public interface IMonoTlsContext : IDisposable
interface IMonoTlsContext : IDisposable
{
bool IsServer {
get;
@@ -1,198 +0,0 @@
//
// MonoSslStream.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Threading.Tasks;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Security.Cryptography;
using Mono.Net.Security;
namespace Mono.Security.Interface
{
public abstract class MonoSslStream
{
public abstract void AuthenticateAsClient (string targetHost);
public abstract void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
public abstract IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState);
public abstract IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
public abstract void EndAuthenticateAsClient (IAsyncResult asyncResult);
public abstract void AuthenticateAsServer (X509Certificate serverCertificate);
public abstract void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
public abstract IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState);
public abstract IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
public abstract void EndAuthenticateAsServer (IAsyncResult asyncResult);
public abstract Task AuthenticateAsClientAsync (string targetHost);
public abstract Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
public abstract Task AuthenticateAsServerAsync (X509Certificate serverCertificate);
public abstract Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
public abstract void Flush ();
public abstract int Read (byte[] buffer, int offset, int count);
public abstract void Write (byte[] buffer);
public abstract void Write (byte[] buffer, int offset, int count);
public abstract IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState);
public abstract int EndRead (IAsyncResult asyncResult);
public abstract IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState);
public abstract void EndWrite (IAsyncResult asyncResult);
public abstract TransportContext TransportContext {
get;
}
public abstract bool IsAuthenticated {
get;
}
public abstract bool IsMutuallyAuthenticated {
get;
}
public abstract bool IsEncrypted {
get;
}
public abstract bool IsSigned {
get;
}
public abstract bool IsServer {
get;
}
public abstract CipherAlgorithmType CipherAlgorithm {
get;
}
public abstract int CipherStrength {
get;
}
public abstract HashAlgorithmType HashAlgorithm {
get;
}
public abstract int HashStrength {
get;
}
public abstract ExchangeAlgorithmType KeyExchangeAlgorithm {
get;
}
public abstract int KeyExchangeStrength {
get;
}
public abstract bool CanRead {
get;
}
public abstract bool CanTimeout {
get;
}
public abstract bool CanWrite {
get;
}
public abstract long Length {
get;
}
public abstract long Position {
get;
}
public abstract void SetLength (long value);
public abstract AuthenticatedStream AuthenticatedStream {
get;
}
public abstract int ReadTimeout {
get; set;
}
public abstract int WriteTimeout {
get; set;
}
public abstract bool CheckCertRevocationStatus {
get;
}
public abstract X509Certificate InternalLocalCertificate {
get;
}
public abstract X509Certificate LocalCertificate {
get;
}
public abstract X509Certificate RemoteCertificate {
get;
}
public abstract SslProtocols SslProtocol {
get;
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
}
}
}
@@ -24,20 +24,35 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Interface
{
public class MonoTlsConnectionInfo
{
public short CipherSuiteCode {
public CipherSuiteCode CipherSuiteCode {
get; set;
}
public TlsProtocols ProtocolVersion {
get; set;
}
public CipherAlgorithmType CipherAlgorithmType {
get; set;
}
public HashAlgorithmType HashAlgorithmType {
get; set;
}
public ExchangeAlgorithmType ExchangeAlgorithmType {
get; set;
}
public override string ToString ()
{
return string.Format ("[MonoTlsConnectionInfo: {0}:{1}]", ProtocolVersion, CipherSuiteCode);
}
}
}
@@ -72,6 +72,18 @@ namespace Mono.Security.Interface
public abstract class MonoTlsProvider
{
internal MonoTlsProvider ()
{
}
public abstract Guid ID {
get;
}
public abstract string Name {
get;
}
#region SslStream
/*
@@ -83,6 +95,13 @@ namespace Mono.Security.Interface
get;
}
/*
* Does this provider support IMonoSslStream.GetConnectionInfo() ?
*/
public abstract bool SupportsConnectionInfo {
get;
}
/*
* Whether or not this TLS Provider supports Mono-specific extensions
* (via @MonoTlsSettings).
@@ -96,26 +115,55 @@ namespace Mono.Security.Interface
}
/*
* Obtain a @MonoSslStream instance.
* Obtain a @IMonoSslStream instance.
*
*/
public abstract MonoSslStream CreateSslStream (
public abstract IMonoSslStream CreateSslStream (
Stream innerStream, bool leaveInnerStreamOpen,
MonoTlsSettings settings = null);
#endregion
#region Certificate Validation
/*
* Allows a TLS provider to provide a custom system certificiate validator.
*/
public virtual bool HasCustomSystemCertificateValidator {
get { return false; }
}
/*
* If @serverMode is true, then we're a server and want to validate a certificate
* that we received from a client.
*
* On OS X and Mobile, the @chain will be initialized with the @certificates, but not actually built.
*
* Returns `true` if certificate validation has been performed and `false` to invoke the
* default system validator.
*/
public virtual bool InvokeSystemCertificateValidator (
ICertificateValidator validator, string targetHost, bool serverMode,
X509CertificateCollection certificates, X509Chain chain, out bool success,
ref MonoSslPolicyErrors errors, ref int status11)
{
success = false;
return false;
}
#endregion
#region Manged SSPI
/*
* The managed SSPI implementation from the new TLS code.
*/
public abstract bool SupportsTlsContext {
internal abstract bool SupportsTlsContext {
get;
}
public abstract IMonoTlsContext CreateTlsContext (
internal abstract IMonoTlsContext CreateTlsContext (
string hostname, bool serverMode, TlsProtocols protocolFlags,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool remoteCertRequired, MonoEncryptionPolicy encryptionPolicy,
@@ -25,8 +25,9 @@
// THE SOFTWARE.
using System;
using System.Net;
using Mono.Net.Security;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Mono.Net.Security;
namespace Mono.Security.Interface
{
@@ -35,7 +36,7 @@ namespace Mono.Security.Interface
*
* Keep in sync with System/Mono.Net.Security/MonoTlsProviderFactory.cs.
*/
public static class MonoTlsProviderFactory
public static partial class MonoTlsProviderFactory
{
/*
* Returns the currently installed @MonoTlsProvider, falling back to the default one.
@@ -71,14 +72,14 @@ namespace Mono.Security.Interface
}
/*
* Installs a custom TLS Provider.
* Selects the default TLS Provider.
*
* May only be called at application startup and will throw
* @InvalidOperationException if a provider has already been installed.
*/
public static void InstallProvider (MonoTlsProvider provider)
public static void SetDefaultProvider (string name)
{
NoReflectionHelper.InstallProvider (provider);
NoReflectionHelper.SetDefaultProvider (name);
}
/*
@@ -93,10 +94,15 @@ namespace Mono.Security.Interface
return NoReflectionHelper.CreateHttpsRequest (requestUri, provider, settings);
}
public static HttpListener CreateHttpListener (X509Certificate2 certificate, MonoTlsProvider provider = null, MonoTlsSettings settings = null)
public static HttpListener CreateHttpListener (X509Certificate certificate, MonoTlsProvider provider = null, MonoTlsSettings settings = null)
{
return (HttpListener)NoReflectionHelper.CreateHttpListener (certificate, provider, settings);
}
public static IMonoSslStream GetMonoSslStream (SslStream stream)
{
return (IMonoSslStream)NoReflectionHelper.GetMonoSslStream (stream);
}
}
}
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Threading;
using System.Security.Cryptography.X509Certificates;
namespace Mono.Security.Interface
@@ -81,14 +82,40 @@ namespace Mono.Security.Interface
get; set;
}
public CipherSuiteCode[] EnabledCiphers {
get; set;
}
bool cloned = false;
bool checkCertName = true;
bool checkCertRevocationStatus = false;
bool useServicePointManagerCallback = false;
bool useServicePointManagerCallback = true;
bool skipSystemValidators = false;
bool callbackNeedsChain = true;
ICertificateValidator certificateValidator;
public MonoTlsSettings ()
{
}
static MonoTlsSettings defaultSettings;
public static MonoTlsSettings DefaultSettings {
get {
if (defaultSettings == null)
Interlocked.CompareExchange (ref defaultSettings, new MonoTlsSettings (), null);
return defaultSettings;
}
set {
defaultSettings = value ?? new MonoTlsSettings ();
}
}
public static MonoTlsSettings CopyDefaultSettings ()
{
return DefaultSettings.Clone ();
}
#region Private APIs
/*
@@ -101,7 +128,6 @@ namespace Mono.Security.Interface
[Obsolete ("Do not use outside System.dll!")]
public ICertificateValidator CertificateValidator {
get { return certificateValidator; }
set { certificateValidator = value; }
}
[Obsolete ("Do not use outside System.dll!")]
@@ -112,22 +138,32 @@ namespace Mono.Security.Interface
return this;
}
var copy = new MonoTlsSettings ();
copy.RemoteCertificateValidationCallback = RemoteCertificateValidationCallback;
copy.ClientCertificateSelectionCallback = ClientCertificateSelectionCallback;
copy.checkCertName = checkCertName;
copy.checkCertRevocationStatus = checkCertRevocationStatus;
copy.UseServicePointManagerCallback = useServicePointManagerCallback;
copy.skipSystemValidators = skipSystemValidators;
copy.callbackNeedsChain = callbackNeedsChain;
copy.UserSettings = UserSettings;
var copy = new MonoTlsSettings (this);
copy.certificateValidator = validator;
copy.EnabledProtocols = EnabledProtocols;
copy.TrustAnchors = TrustAnchors;
copy.cloned = true;
return copy;
}
public MonoTlsSettings Clone ()
{
return new MonoTlsSettings (this);
}
MonoTlsSettings (MonoTlsSettings other)
{
RemoteCertificateValidationCallback = other.RemoteCertificateValidationCallback;
ClientCertificateSelectionCallback = other.ClientCertificateSelectionCallback;
checkCertName = other.checkCertName;
checkCertRevocationStatus = other.checkCertRevocationStatus;
UseServicePointManagerCallback = other.useServicePointManagerCallback;
skipSystemValidators = other.skipSystemValidators;
callbackNeedsChain = other.callbackNeedsChain;
UserSettings = other.UserSettings;
EnabledProtocols = other.EnabledProtocols;
EnabledCiphers = other.EnabledCiphers;
TrustAnchors = other.TrustAnchors;
cloned = true;
}
#endregion
}
}
@@ -0,0 +1,67 @@
//
// SecretParameters.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
public abstract class SecretParameters : IDisposable
{
protected abstract void Clear ();
bool disposed;
protected void CheckDisposed ()
{
if (disposed)
throw new ObjectDisposedException (GetType ().Name);
}
protected static void Clear (byte[] array)
{
Array.Clear (array, 0, array.Length);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
void Dispose (bool disposing)
{
if (!disposed) {
disposed = true;
Clear ();
}
}
~SecretParameters ()
{
Dispose (false);
}
}
}
@@ -0,0 +1,86 @@
//
// SecureBuffer.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
public class SecureBuffer : SecretParameters, IBufferOffsetSize
{
byte[] buffer;
public byte[] Buffer {
get {
CheckDisposed ();
return buffer;
}
}
public int Size {
get {
CheckDisposed ();
return buffer != null ? buffer.Length : 0;
}
}
int IBufferOffsetSize.Offset {
get { return 0; }
}
public SecureBuffer (int size)
{
buffer = new byte [size];
}
public SecureBuffer (byte[] buffer)
{
this.buffer = buffer;
}
public byte[] StealBuffer ()
{
CheckDisposed ();
var retval = this.buffer;
this.buffer = null;
return retval;
}
public static SecureBuffer CreateCopy (byte[] buffer)
{
var copy = new byte [buffer.Length];
Array.Copy (buffer, copy, buffer.Length);
return new SecureBuffer (copy);
}
protected override void Clear ()
{
if (buffer != null) {
Array.Clear (buffer, 0, buffer.Length);
buffer = null;
}
}
}
}
@@ -0,0 +1,334 @@
//
// TlsBuffer.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
public class TlsBuffer : SecretParameters
{
public int Position {
get; set;
}
public int Remaining {
get { return Size - (Position - Offset); }
}
public byte[] Buffer {
get { return innerBuffer.Buffer; }
}
public int Offset {
get { return innerBuffer.Offset; }
}
public int Size {
get { return innerBuffer.Size; }
}
public int EndOffset {
get { return Offset + Size; }
}
IBufferOffsetSize innerBuffer;
protected TlsBuffer ()
: this (null, 0, 0)
{
}
public TlsBuffer (IBufferOffsetSize bos)
{
innerBuffer = bos;
Position = bos.Offset;
}
public TlsBuffer (byte[] buffer, int offset, int size)
: this (new BufferOffsetSize (buffer, offset, size))
{
}
public TlsBuffer (byte[] buffer)
: this (buffer, 0, buffer.Length)
{
}
public TlsBuffer (int size)
: this (new byte [size], 0, size)
{
}
public byte ReadByte ()
{
if (Position >= EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
return Buffer [Position++];
}
public short ReadInt16 ()
{
if (Position + 1 >= EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
var retval = (short)(Buffer [Position] << 8 | Buffer [Position + 1]);
Position += 2;
return retval;
}
public int ReadInt24 ()
{
if (Position + 2 >= EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
var retval = ((Buffer [Position] << 16) | (Buffer [Position+1] << 8) | Buffer [Position+2]);
Position += 3;
return retval;
}
public int ReadInt32 ()
{
if (Position + 3 >= EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
var retval = ((Buffer [Position] << 24) | (Buffer [Position+1] << 16) | (Buffer [Position+2] << 8) | Buffer [Position+3]);
Position += 4;
return retval;
}
public TlsBuffer ReadBuffer (int length)
{
if (Position + length > EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
var retval = new TlsBuffer (Buffer, Position, length);
Position += length;
return retval;
}
public IBufferOffsetSize GetRemaining ()
{
return new BufferOffsetSize (Buffer, Position, Remaining);
}
protected virtual void MakeRoomInternal (int size)
{
if (Position + size > EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
}
public void Write (byte value)
{
MakeRoomInternal (1);
Buffer [Position++] = value;
}
public void Write (short value)
{
MakeRoomInternal (2);
WriteInt16 (Buffer, Position, value);
Position += 2;
}
public static void WriteInt16 (byte[] buffer, int offset, short value)
{
buffer[offset] = ((byte)(value >> 8));
buffer[offset+1] = ((byte)value);
}
public void Write (int value)
{
MakeRoomInternal (4);
WriteInt32 (Buffer, Position, value);
Position += 4;
}
public void WriteInt24 (int value)
{
MakeRoomInternal (3);
WriteInt24 (Buffer, Position, value);
Position += 3;
}
#pragma warning disable 3001
public void Write (ulong value)
#pragma warning restore 3001
{
MakeRoomInternal (8);
WriteInt64 (Buffer, Position, value);
Position += 8;
}
public static void WriteInt24 (byte[] buffer, int offset, int value)
{
buffer[offset] = ((byte)(value >> 16));
buffer[offset+1] = ((byte)(value >> 8));
buffer[offset+2] = ((byte)value);
}
public static void WriteInt32 (byte[] buffer, int offset, int value)
{
buffer[offset] = ((byte)(value >> 24));
buffer[offset+1] = ((byte)(value >> 16));
buffer[offset+2] = ((byte)(value >> 8));
buffer[offset+3] = ((byte)value);
}
#pragma warning disable 3001
public static void WriteInt64 (byte[] buffer, int offset, ulong value)
#pragma warning restore 3001
{
buffer[offset] = (byte) (value >> 56);
buffer[offset+1] = (byte) (value >> 48);
buffer[offset+2] = (byte) (value >> 40);
buffer[offset+3] = (byte) (value >> 32);
buffer[offset+4] = (byte) (value >> 24);
buffer[offset+5] = (byte) (value >> 16);
buffer[offset+6] = (byte) (value >> 8);
buffer[offset+7] = (byte) value;
}
public void Write (byte[] buffer)
{
Write (buffer, 0, buffer.Length);
}
public void Write (byte[] buffer, int offset, int size)
{
MakeRoomInternal (size);
Array.Copy (buffer, offset, Buffer, Position, size);
Position += size;
}
public void Write (IBufferOffsetSize buffer)
{
Write (buffer.Buffer, buffer.Offset, buffer.Size);
}
public SecureBuffer ReadSecureBuffer (int count)
{
return new SecureBuffer (ReadBytes (count));
}
public byte[] ReadBytes (int count)
{
if (Position + count > EndOffset)
throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
var retval = new byte [count];
Array.Copy (Buffer, Position, retval, 0, count);
Position += count;
return retval;
}
internal static bool Compare (SecureBuffer buffer1, SecureBuffer buffer2)
{
if (buffer1 == null || buffer2 == null)
return false;
if (buffer1.Size != buffer2.Size)
return false;
for (int i = 0; i < buffer1.Size; i++) {
if (buffer1.Buffer [i] != buffer2.Buffer [i])
return false;
}
return true;
}
public static bool Compare (IBufferOffsetSize buffer1, IBufferOffsetSize buffer2)
{
if (buffer1 == null || buffer2 == null)
return false;
if (buffer1.Size != buffer2.Size)
return false;
for (int i = 0; i < buffer1.Size; i++) {
if (buffer1.Buffer [buffer1.Offset + i] != buffer2.Buffer [buffer2.Offset + i])
return false;
}
return true;
}
public static bool Compare (byte[] buffer1, byte[] buffer2)
{
if (buffer1 == null || buffer2 == null)
return false;
return Compare (buffer1, 0, buffer1.Length, buffer2, 0, buffer2.Length);
}
public static bool Compare (byte[] buffer1, int offset1, int size1, byte[] buffer2, int offset2, int size2)
{
if (buffer1 == null || buffer2 == null)
return false;
if (size1 != size2)
return false;
for (int i = 0; i < size1; i++) {
if (buffer1 [offset1 + i] != buffer2 [offset2 + i])
return false;
}
return true;
}
public static int ConstantTimeCompare (byte[] buffer1, int offset1, int size1, byte[] buffer2, int offset2, int size2)
{
int status = 0;
int effectiveSize;
if (size1 < size2) {
status--;
effectiveSize = size1;
} else if (size2 < size1) {
status--;
effectiveSize = size2;
} else {
effectiveSize = size1;
}
for (int i = 0; i < effectiveSize; i++) {
if (buffer1 [offset1 + i] != buffer2 [offset2 + i])
status--;
}
return status;
}
protected void SetBuffer (byte[] buffer, int offset, int size)
{
innerBuffer = new BufferOffsetSize (buffer, offset, size);
}
protected override void Clear ()
{
var disposable = innerBuffer as IDisposable;
if (disposable != null)
disposable.Dispose ();
innerBuffer = null;
Position = 0;
}
public static readonly byte[] EmptyArray = new byte [0];
}
}
@@ -0,0 +1,84 @@
//
// TlsException.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Text;
using System.Runtime.Serialization;
namespace Mono.Security.Interface
{
public sealed class TlsException : Exception
{
#region Fields
private Alert alert;
#endregion
#region Properties
public Alert Alert {
get { return this.alert; }
}
#endregion
#region Constructors
public TlsException (Alert alert)
: this (alert, alert.Description.ToString())
{
}
public TlsException (Alert alert, string message)
: base (message)
{
this.alert = alert;
}
public TlsException (AlertLevel level, AlertDescription description)
: this (new Alert (level, description))
{
}
public TlsException (AlertDescription description)
: this (new Alert (description))
{
}
public TlsException (AlertDescription description, string message)
: this (new Alert (description), message)
{
}
public TlsException (AlertDescription description, string format, params object[] args)
: this (new Alert (description), string.Format (format, args))
{
}
#endregion
}
}
@@ -0,0 +1,119 @@
//
// TlsMultiBuffer.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
public class TlsMultiBuffer
{
MemoryChunk first, last;
private class MemoryChunk : BufferOffsetSize
{
public MemoryChunk next;
public MemoryChunk (byte[] buffer, int offset, int size)
: base (buffer, offset, size)
{
}
}
public bool IsEmpty {
get { return first == null; }
}
public bool IsSingle {
get { return first != null && first.next == null; }
}
public void Add (TlsBuffer buffer)
{
Add (buffer.Buffer, buffer.Offset, buffer.Size);
}
public void Add (byte[] buffer)
{
Add (buffer, 0, buffer.Length);
}
public void Add (byte[] buffer, int offset, int size)
{
var chunk = new MemoryChunk (buffer, offset, size);
if (last == null)
first = last = chunk;
else {
last.next = chunk;
last = chunk;
}
}
public BufferOffsetSize[] GetBufferArray ()
{
int count = 0;
for (var ptr = first; ptr != null; ptr = ptr.next)
count++;
var array = new BufferOffsetSize [count];
count = 0;
for (var ptr = first; ptr != null; ptr = ptr.next)
array [count++] = ptr;
return array;
}
public void Clear ()
{
for (var ptr = first; ptr != null; ptr = ptr.next)
ptr.Dispose ();
first = last = null;
}
public BufferOffsetSize GetBuffer ()
{
int totalSize = 0;
for (var ptr = first; ptr != null; ptr = ptr.next)
totalSize += ptr.Size;
var outBuffer = new BufferOffsetSize (new byte [totalSize]);
int offset = 0;
for (var ptr = first; ptr != null; ptr = ptr.next) {
Buffer.BlockCopy (ptr.Buffer, ptr.Offset, outBuffer.Buffer, offset, ptr.Size);
offset += ptr.Size;
}
return outBuffer;
}
public BufferOffsetSize StealBuffer ()
{
if (IsSingle) {
var retval = first;
first = last = null;
return retval;
}
return GetBuffer ();
}
}
}
@@ -0,0 +1,38 @@
//
// TlsProtocolCode.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
{
public enum TlsProtocolCode : short
{
Tls10 = 0x301,
Tls11 = 0x302,
Tls12 = 0x303
}
}
@@ -1,3 +1,29 @@
//
// TlsProtocols.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Mono.Security.Interface
@@ -89,7 +89,7 @@ namespace Mono.Security.Protocol.Ntlm {
public Type3Message (Type2Message type2) : base (3)
{
_type2 = type2;
_level = DefaultAuthLevel;
_level = NtlmSettings.DefaultAuthLevel;
_challenge = (byte[]) type2.Nonce.Clone ();
_domain = type2.TargetName;
@@ -269,11 +269,13 @@ namespace Mono.Security.Protocol.Ntlm {
throw new InvalidOperationException (
"Refusing to use legacy-mode LM/NTLM authentication " +
"unless explicitly enabled using DefaultAuthLevel.");
#pragma warning disable 618
using (var legacy = new ChallengeResponse (_password, _challenge)) {
lm = legacy.LM;
ntlm = legacy.NT;
}
#pragma warning restore 618
} else {
ChallengeResponse2.Compute (_type2, _level, _username, _password, _domain, out lm, out ntlm);
}
@@ -131,6 +131,7 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
private X509Certificate FindParentCertificate (X509Certificate cert)
{
#pragma warning disable 618
// This certificate is the root certificate
if (cert.GetName () == cert.GetIssuerName ())
return null;
@@ -140,6 +141,7 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
return certificate;
}
return null;
#pragma warning restore 618
}
#endregion
@@ -597,7 +597,7 @@ namespace Mono.Security.Protocol.Tls
try {
SendAlert(alert);
} catch (Exception alertEx) {
ex = new IOException (string.Format ("Error while sending TLS Alert ({0}:{1}): {2}", alert.Level, alert.Description, ex), ex);
ex = new IOException (string.Format ("Error while sending TLS Alert ({0}:{1}): {2}", alert.Level, alert.Description, ex), alertEx);
}
}
@@ -132,7 +132,6 @@ namespace Mono.Security.Protocol.Tls
throw new TlsException(AlertDescription.UnexpectedMessage, String.Format(CultureInfo.CurrentUICulture,
"Unknown server handshake message received ({0})",
type.ToString()));
break;
}
throw new TlsException (AlertDescription.HandshakeFailiure, String.Format ("Protocol error, unexpected protocol transition from {0} to {1}", last, type));
}
@@ -430,6 +430,10 @@ namespace Mono.Security.X509 {
public string Password {
set {
// Clear old password.
if (_password != null)
Array.Clear (_password, 0, _password.Length);
_password = null;
if (value != null) {
if (value.Length > 0) {
int size = value.Length;
@@ -447,9 +451,6 @@ namespace Mono.Security.X509 {
// double-byte (Unicode) NULL (0x00) - see bug #79617
_password = new byte[2];
}
} else {
// no password
_password = null;
}
}
}
@@ -135,13 +135,26 @@
./Mono.Xml/MiniParser.cs
./Mono.Xml/SecurityParser.cs
./Mono.Security.Interface/Alert.cs
./Mono.Security.Interface/CertificateValidationHelper.cs
./Mono.Security.Interface/CipherAlgorithmType.cs
./Mono.Security.Interface/CipherSuiteCode.cs
./Mono.Security.Interface/ExchangeAlgorithmType.cs
./Mono.Security.Interface/HashAlgorithmType.cs
./Mono.Security.Interface/IBufferOffsetSize.cs
./Mono.Security.Interface/IMonoTlsEventSink.cs
./Mono.Security.Interface/IMonoTlsContext.cs
./Mono.Security.Interface/MonoSslStream.cs
./Mono.Security.Interface/IMonoSslStream.cs
./Mono.Security.Interface/MonoTlsConnectionInfo.cs
./Mono.Security.Interface/MonoTlsProvider.cs
./Mono.Security.Interface/MonoTlsProviderFactory.cs
./Mono.Security.Interface/MonoTlsSettings.cs
./Mono.Security.Interface/TlsException.cs
./Mono.Security.Interface/TlsProtocolCode.cs
./Mono.Security.Interface/TlsProtocols.cs
./Mono.Security.Interface/BufferOffsetSize.cs
./Mono.Security.Interface/SecretParameters.cs
./Mono.Security.Interface/SecureBuffer.cs
./Mono.Security.Interface/TlsBuffer.cs
./Mono.Security.Interface/TlsMultiBuffer.cs
@@ -0,0 +1,138 @@
./Assembly/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Math/BigInteger.cs
./Mono.Math.Prime/ConfidenceFactor.cs
./Mono.Math.Prime/PrimalityTests.cs
./Mono.Math.Prime.Generator/NextPrimeFinder.cs
./Mono.Math.Prime.Generator/PrimeGeneratorBase.cs
./Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs
./Mono.Security/ASN1.cs
./Mono.Security/ASN1Convert.cs
./Mono.Security/BitConverterLE.cs
./Mono.Security/PKCS7.cs
./Mono.Security/StrongName.cs
./Mono.Security.Authenticode/AuthenticodeBase.cs
./Mono.Security.Authenticode/AuthenticodeDeformatter.cs
./Mono.Security.Authenticode/AuthenticodeFormatter.cs
./Mono.Security.Authenticode/SoftwarePublisherCertificate.cs
./Mono.Security.Authenticode/PrivateKey.cs
./Mono.Security.Cryptography/CryptoConvert.cs
./Mono.Security.Cryptography/CryptoTools.cs
./Mono.Security.Cryptography/DHKeyGeneration.cs
./Mono.Security.Cryptography/DHParameters.cs
./Mono.Security.Cryptography/DiffieHellman.cs
./Mono.Security.Cryptography/DiffieHellmanManaged.cs
./Mono.Security.Cryptography/KeyPairPersistence.cs
./Mono.Security.Cryptography/MD2.cs
./Mono.Security.Cryptography/MD4.cs
./Mono.Security.Cryptography/PKCS1.cs
./Mono.Security.Cryptography/PKCS8.cs
./Mono.Security.Cryptography/RC4.cs
./Mono.Security.Cryptography/RSAManaged.cs
./Mono.Security.Cryptography/SHA224.cs
./Mono.Security.Cryptography/SymmetricTransform.cs
./Mono.Security.X509/PKCS12.cs
./Mono.Security.X509/X501Name.cs
./Mono.Security.X509/X509Builder.cs
./Mono.Security.X509/X509Certificate.cs
./Mono.Security.X509/X509CertificateCollection.cs
./Mono.Security.X509/X509CertificateBuilder.cs
./Mono.Security.X509/X509Chain.cs
./Mono.Security.X509/X509ChainStatusFlags.cs
./Mono.Security.X509/X509CRL.cs
./Mono.Security.X509/X509Extension.cs
./Mono.Security.X509/X509Extensions.cs
./Mono.Security.X509/X509Store.cs
./Mono.Security.X509/X509StoreManager.cs
./Mono.Security.X509/X509Stores.cs
./Mono.Security.X509/X520Attributes.cs
./Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs
./Mono.Security.X509.Extensions/BasicConstraintsExtension.cs
./Mono.Security.X509.Extensions/CRLDistributionPointsExtension.cs
./Mono.Security.X509.Extensions/CertificatePoliciesExtension.cs
./Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs
./Mono.Security.X509.Extensions/GeneralNames.cs
./Mono.Security.X509.Extensions/KeyAttributesExtension.cs
./Mono.Security.X509.Extensions/KeyUsageExtension.cs
./Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs
./Mono.Security.X509.Extensions/PrivateKeyUsagePeriodExtension.cs
./Mono.Security.X509.Extensions/SubjectAltNameExtension.cs
./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs
./Mono.Security.Cryptography/TlsHMAC.cs
./Mono.Security.Cryptography/MD5SHA1.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
./Mono.Security.Protocol.Ntlm/MessageBase.cs
./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
./Mono.Security.Protocol.Ntlm/NtlmSettings.cs
./Mono.Security.Protocol.Ntlm/Type1Message.cs
./Mono.Security.Protocol.Ntlm/Type2Message.cs
./Mono.Security.Protocol.Ntlm/Type3Message.cs
./Mono.Security.Protocol.Tls/Alert.cs
./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
./Mono.Security.Protocol.Tls/CipherSuite.cs
./Mono.Security.Protocol.Tls/CipherSuiteCollection.cs
./Mono.Security.Protocol.Tls/CipherSuiteFactory.cs
./Mono.Security.Protocol.Tls/ClientContext.cs
./Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
./Mono.Security.Protocol.Tls/ClientSessionCache.cs
./Mono.Security.Protocol.Tls/ContentType.cs
./Mono.Security.Protocol.Tls/Context.cs
./Mono.Security.Protocol.Tls/DebugHelper.cs
./Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs
./Mono.Security.Protocol.Tls/HandshakeState.cs
./Mono.Security.Protocol.Tls/HashAlgorithmType.cs
./Mono.Security.Protocol.Tls/HttpsClientStream.cs
./Mono.Security.Protocol.Tls/RecordProtocol.cs
./Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs
./Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs
./Mono.Security.Protocol.Tls/SecurityCompressionType.cs
./Mono.Security.Protocol.Tls/SecurityParameters.cs
./Mono.Security.Protocol.Tls/SecurityProtocolType.cs
./Mono.Security.Protocol.Tls/ServerContext.cs
./Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
./Mono.Security.Protocol.Tls/SslClientStream.cs
./Mono.Security.Protocol.Tls/SslCipherSuite.cs
./Mono.Security.Protocol.Tls/SslHandshakeHash.cs
./Mono.Security.Protocol.Tls/SslServerStream.cs
./Mono.Security.Protocol.Tls/SslStreamBase.cs
./Mono.Security.Protocol.Tls/TlsCipherSuite.cs
./Mono.Security.Protocol.Tls/TlsClientSettings.cs
./Mono.Security.Protocol.Tls/TlsException.cs
./Mono.Security.Protocol.Tls/TlsServerSettings.cs
./Mono.Security.Protocol.Tls/TlsStream.cs
./Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs
./Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs
./Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
./Mono.Xml/MiniParser.cs
./Mono.Xml/SecurityParser.cs
./Mono.Security.Interface/BufferOffsetSize.cs
./Mono.Security.Interface/SecretParameters.cs
./Mono.Security.Interface/SecureBuffer.cs
./Mono.Security.Interface/TlsBuffer.cs
./Mono.Security.Interface/TlsMultiBuffer.cs
@@ -0,0 +1,5 @@
#include mobile_Mono.Security.dll.sources
./Mono.Security.Cryptography/ARC4Managed.cs
./Mono.Security.Cryptography/MD2Managed.cs
./Mono.Security.Cryptography/MD4Managed.cs
./Mono.Security.Cryptography/SHA224Managed.cs
@@ -1,138 +1,5 @@
./Assembly/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Math/BigInteger.cs
./Mono.Math.Prime/ConfidenceFactor.cs
./Mono.Math.Prime/PrimalityTests.cs
./Mono.Math.Prime.Generator/NextPrimeFinder.cs
./Mono.Math.Prime.Generator/PrimeGeneratorBase.cs
./Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs
./Mono.Security/ASN1.cs
./Mono.Security/ASN1Convert.cs
./Mono.Security/BitConverterLE.cs
./Mono.Security/PKCS7.cs
./Mono.Security/StrongName.cs
./Mono.Security.Authenticode/AuthenticodeBase.cs
./Mono.Security.Authenticode/AuthenticodeDeformatter.cs
./Mono.Security.Authenticode/AuthenticodeFormatter.cs
./Mono.Security.Authenticode/SoftwarePublisherCertificate.cs
./Mono.Security.Authenticode/PrivateKey.cs
#include mobile_Mono.Security.dll.sources
./Mono.Security.Cryptography/ARC4Managed.cs
./Mono.Security.Cryptography/CryptoConvert.cs
./Mono.Security.Cryptography/CryptoTools.cs
./Mono.Security.Cryptography/DHKeyGeneration.cs
./Mono.Security.Cryptography/DHParameters.cs
./Mono.Security.Cryptography/DiffieHellman.cs
./Mono.Security.Cryptography/DiffieHellmanManaged.cs
./Mono.Security.Cryptography/KeyPairPersistence.cs
./Mono.Security.Cryptography/MD2.cs
./Mono.Security.Cryptography/MD2Managed.cs
./Mono.Security.Cryptography/MD4.cs
./Mono.Security.Cryptography/MD4Managed.cs
./Mono.Security.Cryptography/PKCS1.cs
./Mono.Security.Cryptography/PKCS8.cs
./Mono.Security.Cryptography/RC4.cs
./Mono.Security.Cryptography/RSAManaged.cs
./Mono.Security.Cryptography/SHA224.cs
./Mono.Security.Cryptography/SHA224Managed.cs
./Mono.Security.Cryptography/SymmetricTransform.cs
./Mono.Security.X509/PKCS12.cs
./Mono.Security.X509/X501Name.cs
./Mono.Security.X509/X509Builder.cs
./Mono.Security.X509/X509Certificate.cs
./Mono.Security.X509/X509CertificateCollection.cs
./Mono.Security.X509/X509CertificateBuilder.cs
./Mono.Security.X509/X509Chain.cs
./Mono.Security.X509/X509ChainStatusFlags.cs
./Mono.Security.X509/X509CRL.cs
./Mono.Security.X509/X509Extension.cs
./Mono.Security.X509/X509Extensions.cs
./Mono.Security.X509/X509Store.cs
./Mono.Security.X509/X509StoreManager.cs
./Mono.Security.X509/X509Stores.cs
./Mono.Security.X509/X520Attributes.cs
./Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs
./Mono.Security.X509.Extensions/BasicConstraintsExtension.cs
./Mono.Security.X509.Extensions/CRLDistributionPointsExtension.cs
./Mono.Security.X509.Extensions/CertificatePoliciesExtension.cs
./Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs
./Mono.Security.X509.Extensions/GeneralNames.cs
./Mono.Security.X509.Extensions/KeyAttributesExtension.cs
./Mono.Security.X509.Extensions/KeyUsageExtension.cs
./Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs
./Mono.Security.X509.Extensions/PrivateKeyUsagePeriodExtension.cs
./Mono.Security.X509.Extensions/SubjectAltNameExtension.cs
./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs
./Mono.Security.Cryptography/TlsHMAC.cs
./Mono.Security.Cryptography/MD5SHA1.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
./Mono.Security.Protocol.Ntlm/MessageBase.cs
./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
./Mono.Security.Protocol.Ntlm/NtlmSettings.cs
./Mono.Security.Protocol.Ntlm/Type1Message.cs
./Mono.Security.Protocol.Ntlm/Type2Message.cs
./Mono.Security.Protocol.Ntlm/Type3Message.cs
./Mono.Security.Protocol.Tls/Alert.cs
./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
./Mono.Security.Protocol.Tls/CipherSuite.cs
./Mono.Security.Protocol.Tls/CipherSuiteCollection.cs
./Mono.Security.Protocol.Tls/CipherSuiteFactory.cs
./Mono.Security.Protocol.Tls/ClientContext.cs
./Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
./Mono.Security.Protocol.Tls/ClientSessionCache.cs
./Mono.Security.Protocol.Tls/ContentType.cs
./Mono.Security.Protocol.Tls/Context.cs
./Mono.Security.Protocol.Tls/DebugHelper.cs
./Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs
./Mono.Security.Protocol.Tls/HandshakeState.cs
./Mono.Security.Protocol.Tls/HashAlgorithmType.cs
./Mono.Security.Protocol.Tls/HttpsClientStream.cs
./Mono.Security.Protocol.Tls/RecordProtocol.cs
./Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs
./Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs
./Mono.Security.Protocol.Tls/SecurityCompressionType.cs
./Mono.Security.Protocol.Tls/SecurityParameters.cs
./Mono.Security.Protocol.Tls/SecurityProtocolType.cs
./Mono.Security.Protocol.Tls/ServerContext.cs
./Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
./Mono.Security.Protocol.Tls/SslClientStream.cs
./Mono.Security.Protocol.Tls/SslCipherSuite.cs
./Mono.Security.Protocol.Tls/SslHandshakeHash.cs
./Mono.Security.Protocol.Tls/SslServerStream.cs
./Mono.Security.Protocol.Tls/SslStreamBase.cs
./Mono.Security.Protocol.Tls/TlsCipherSuite.cs
./Mono.Security.Protocol.Tls/TlsClientSettings.cs
./Mono.Security.Protocol.Tls/TlsException.cs
./Mono.Security.Protocol.Tls/TlsServerSettings.cs
./Mono.Security.Protocol.Tls/TlsStream.cs
./Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs
./Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs
./Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
./Mono.Xml/MiniParser.cs
./Mono.Xml/SecurityParser.cs
./Mono.Security.Interface/CertificateValidationHelper.cs
@@ -1,134 +1 @@
./Assembly/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Math/BigInteger.cs
./Mono.Math.Prime/ConfidenceFactor.cs
./Mono.Math.Prime/PrimalityTests.cs
./Mono.Math.Prime.Generator/NextPrimeFinder.cs
./Mono.Math.Prime.Generator/PrimeGeneratorBase.cs
./Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs
./Mono.Security/ASN1.cs
./Mono.Security/ASN1Convert.cs
./Mono.Security/BitConverterLE.cs
./Mono.Security/PKCS7.cs
./Mono.Security/StrongName.cs
./Mono.Security.Authenticode/AuthenticodeBase.cs
./Mono.Security.Authenticode/AuthenticodeDeformatter.cs
./Mono.Security.Authenticode/AuthenticodeFormatter.cs
./Mono.Security.Authenticode/SoftwarePublisherCertificate.cs
./Mono.Security.Authenticode/PrivateKey.cs
./Mono.Security.Cryptography/CryptoConvert.cs
./Mono.Security.Cryptography/CryptoTools.cs
./Mono.Security.Cryptography/DHKeyGeneration.cs
./Mono.Security.Cryptography/DHParameters.cs
./Mono.Security.Cryptography/DiffieHellman.cs
./Mono.Security.Cryptography/DiffieHellmanManaged.cs
./Mono.Security.Cryptography/KeyPairPersistence.cs
./Mono.Security.Cryptography/MD2.cs
./Mono.Security.Cryptography/MD4.cs
./Mono.Security.Cryptography/PKCS1.cs
./Mono.Security.Cryptography/PKCS8.cs
./Mono.Security.Cryptography/RC4.cs
./Mono.Security.Cryptography/RSAManaged.cs
./Mono.Security.Cryptography/SHA224.cs
./Mono.Security.Cryptography/SymmetricTransform.cs
./Mono.Security.X509/PKCS12.cs
./Mono.Security.X509/X501Name.cs
./Mono.Security.X509/X509Builder.cs
./Mono.Security.X509/X509Certificate.cs
./Mono.Security.X509/X509CertificateCollection.cs
./Mono.Security.X509/X509CertificateBuilder.cs
./Mono.Security.X509/X509Chain.cs
./Mono.Security.X509/X509ChainStatusFlags.cs
./Mono.Security.X509/X509CRL.cs
./Mono.Security.X509/X509Extension.cs
./Mono.Security.X509/X509Extensions.cs
./Mono.Security.X509/X509Store.cs
./Mono.Security.X509/X509StoreManager.cs
./Mono.Security.X509/X509Stores.cs
./Mono.Security.X509/X520Attributes.cs
./Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs
./Mono.Security.X509.Extensions/BasicConstraintsExtension.cs
./Mono.Security.X509.Extensions/CRLDistributionPointsExtension.cs
./Mono.Security.X509.Extensions/CertificatePoliciesExtension.cs
./Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs
./Mono.Security.X509.Extensions/GeneralNames.cs
./Mono.Security.X509.Extensions/KeyAttributesExtension.cs
./Mono.Security.X509.Extensions/KeyUsageExtension.cs
./Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs
./Mono.Security.X509.Extensions/PrivateKeyUsagePeriodExtension.cs
./Mono.Security.X509.Extensions/SubjectAltNameExtension.cs
./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs
./Mono.Security.Cryptography/TlsHMAC.cs
./Mono.Security.Cryptography/MD5SHA1.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
./Mono.Security.Protocol.Ntlm/MessageBase.cs
./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
./Mono.Security.Protocol.Ntlm/NtlmSettings.cs
./Mono.Security.Protocol.Ntlm/Type1Message.cs
./Mono.Security.Protocol.Ntlm/Type2Message.cs
./Mono.Security.Protocol.Ntlm/Type3Message.cs
./Mono.Security.Protocol.Tls/Alert.cs
./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
./Mono.Security.Protocol.Tls/CipherSuite.cs
./Mono.Security.Protocol.Tls/CipherSuiteCollection.cs
./Mono.Security.Protocol.Tls/CipherSuiteFactory.cs
./Mono.Security.Protocol.Tls/ClientContext.cs
./Mono.Security.Protocol.Tls/ClientRecordProtocol.cs
./Mono.Security.Protocol.Tls/ClientSessionCache.cs
./Mono.Security.Protocol.Tls/ContentType.cs
./Mono.Security.Protocol.Tls/Context.cs
./Mono.Security.Protocol.Tls/DebugHelper.cs
./Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs
./Mono.Security.Protocol.Tls/HandshakeState.cs
./Mono.Security.Protocol.Tls/HashAlgorithmType.cs
./Mono.Security.Protocol.Tls/HttpsClientStream.cs
./Mono.Security.Protocol.Tls/RecordProtocol.cs
./Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs
./Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs
./Mono.Security.Protocol.Tls/SecurityCompressionType.cs
./Mono.Security.Protocol.Tls/SecurityParameters.cs
./Mono.Security.Protocol.Tls/SecurityProtocolType.cs
./Mono.Security.Protocol.Tls/ServerContext.cs
./Mono.Security.Protocol.Tls/ServerRecordProtocol.cs
./Mono.Security.Protocol.Tls/SslClientStream.cs
./Mono.Security.Protocol.Tls/SslCipherSuite.cs
./Mono.Security.Protocol.Tls/SslHandshakeHash.cs
./Mono.Security.Protocol.Tls/SslServerStream.cs
./Mono.Security.Protocol.Tls/SslStreamBase.cs
./Mono.Security.Protocol.Tls/TlsCipherSuite.cs
./Mono.Security.Protocol.Tls/TlsClientSettings.cs
./Mono.Security.Protocol.Tls/TlsException.cs
./Mono.Security.Protocol.Tls/TlsServerSettings.cs
./Mono.Security.Protocol.Tls/TlsStream.cs
./Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs
./Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs
./Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs
./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs
./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs
./Mono.Xml/MiniParser.cs
./Mono.Xml/SecurityParser.cs
./Mono.Security.Interface/CertificateValidationHelper.cs
#include mobile_Mono.Security.dll.sources
@@ -1,11 +1,2 @@
#include monotouch_Mono.Security.dll.sources
./Mono.Security.Interface/IBufferOffsetSize.cs
./Mono.Security.Interface/IMonoTlsEventSink.cs
./Mono.Security.Interface/IMonoTlsContext.cs
./Mono.Security.Interface/MonoSslStream.cs
./Mono.Security.Interface/MonoTlsConnectionInfo.cs
./Mono.Security.Interface/MonoTlsProvider.cs
./Mono.Security.Interface/MonoTlsProviderFactory.cs
./Mono.Security.Interface/MonoTlsSettings.cs
./Mono.Security.Interface/TlsProtocols.cs
@@ -277,6 +277,10 @@ namespace MonoTests.System.Linq.Expressions
[Test]
public void NegateDecimal ()
{
// Make sure the negate method is not linked away
decimal d1 = 1;
decimal d2 = -d1;
var d = Expression.Parameter (typeof (decimal), "l");
var meth = typeof (decimal).GetMethod ("op_UnaryNegation", new [] { typeof (decimal) });
@@ -0,0 +1 @@
#include monotouch_System.Core.dll.sources
@@ -0,0 +1 @@
#include monotouch_System.Core.dll.sources
+94
View File
@@ -0,0 +1,94 @@
// help building System.Data without win32-specific p/invokes
using System;
using System.Diagnostics;
internal static partial class Bid {
internal enum ApiGroup : uint {
Pooling = 0x00001000,
Correlation = 0x00040000,
}
internal static bool AdvancedOn {
get { return false; }
}
internal static bool IsOn (ApiGroup flag)
{
return false;
}
[Conditional ("BID")]
internal static void Trace (params object[] a)
{
}
[Conditional ("BID")]
internal static void PoolerTrace (params object[] a)
{
}
// out method can't be conditional
internal static void ScopeEnter (out IntPtr p, params object[] a)
{
p = IntPtr.Zero;
}
[Conditional ("BID")]
internal static void ScopeLeave (ref IntPtr a)
{
}
// out method can't be conditional
internal static void PoolerScopeEnter (out IntPtr p, string a, System.Int32 b)
{
p = IntPtr.Zero;
}
}
[ConditionalAttribute ("CODE_ANALYSIS")]
[AttributeUsage (AttributeTargets.Method)]
internal sealed class BidMethodAttribute : Attribute {
}
[ConditionalAttribute ("CODE_ANALYSIS")]
[AttributeUsage (AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple=true)]
internal sealed class BidArgumentTypeAttribute : Attribute {
internal BidArgumentTypeAttribute (Type bidArgumentType)
{
}
}
namespace System.Data.Common {
internal static class UnsafeNativeMethods {
// note: likely unreachable code - as this never worked on mono
internal static int lstrlenW (IntPtr p)
{
throw new NotImplementedException ();
}
static internal int CreateWellKnownSid (int sidType, byte[] domainSid, byte[] resultSid, ref uint resultSidLength )
{
return -1;
}
static internal bool CheckTokenMembership (IntPtr tokenHandle, byte[] sidToCheck, out bool isMember)
{
isMember = false;
return false;
}
static internal bool GetTokenInformation (IntPtr tokenHandle, uint token_class, IntPtr tokenStruct, uint tokenInformationLength, ref uint tokenString)
{
return false;
}
static internal bool ConvertSidToStringSidW (IntPtr sid, out IntPtr stringSid)
{
stringSid = IntPtr.Zero;
return false;
}
}
}
@@ -983,6 +983,7 @@ table was set.
eventWriter.WriteLine (" add a column with an empty name.");
AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
GC.KeepAlive (dv);
}
public class ComplexEventSequence1View : DataView
@@ -1,4 +1,4 @@
../../../external/referencesource/System.Data/bid/inc/cs/bidPrivateBase.cs
MobileStubs.cs
../../../external/referencesource/System.Data/Microsoft/SqlServer/Server/SqlTriggerContext.cs
@@ -66,7 +66,6 @@
../../../external/referencesource/System.Data/System/Data/Common/ObjectStorage.cs
../../../external/referencesource/System.Data/System/Data/Common/RowUpdatedEventArgs.cs
../../../external/referencesource/System.Data/System/Data/Common/RowUpdatingEventArgs.cs
../../../external/referencesource/System.Data/System/Data/Common/SafeNativeMethods.cs
../../../external/referencesource/System.Data/System/Data/Common/SByteStorage.cs
../../../external/referencesource/System.Data/System/Data/Common/SchemaTableColumn.cs
../../../external/referencesource/System.Data/System/Data/Common/SchemaTableOptionalColumn.cs
@@ -91,12 +90,10 @@
../../../external/referencesource/System.Data/System/Data/Common/SQLTypes/SqlXmlStorage.cs
../../../external/referencesource/System.Data/System/Data/Common/StringStorage.cs
../../../external/referencesource/System.Data/System/Data/Common/SupportedJoinOperators.cs
../../../external/referencesource/System.Data/System/Data/Common/System.Data_BID.cs
../../../external/referencesource/System.Data/System/Data/Common/TimeSpanStorage.cs
../../../external/referencesource/System.Data/System/Data/Common/UInt16Storage.cs
../../../external/referencesource/System.Data/System/Data/Common/UInt32Storage.cs
../../../external/referencesource/System.Data/System/Data/Common/UInt64Storage.cs
../../../external/referencesource/System.Data/System/Data/Common/UnsafeNativeMethods.cs
../../../external/referencesource/System.Data/System/Data/ConflictOptions.cs
../../../external/referencesource/System.Data/System/Data/ConnectionState.cs
../../../external/referencesource/System.Data/System/Data/ConstraintCollection.cs
@@ -193,24 +190,13 @@
../../../external/referencesource/System.Data/System/Data/PrimaryKeyTypeConverter.cs
../../../external/referencesource/System.Data/System/Data/PropertyCollection.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DataReaderContainer.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbBuffer.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionClosed.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs
# ../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionHelper.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionInternal.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolAuthenticationContext.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolAuthenticationContextKey.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroupProviderInfo.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolOptions.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolProviderInfo.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbMetaDataCollectionNames.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbMetaDataColumnNames.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbMetaDataFactory.cs
# ../../../external/referencesource/System.Data/System/Data/ProviderBase/DbParameterCollectionHelper.cs
# ../../../external/referencesource/System.Data/System/Data/ProviderBase/DbParameterHelper.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/DbReferenceCollection.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/SchemaMapping.cs
../../../external/referencesource/System.Data/System/Data/ProviderBase/TimeoutTimer.cs
@@ -38,8 +38,10 @@ using System.Runtime.InteropServices;
namespace System.Drawing
{
#if !MONOTOUCH && !MONOMAC
[TypeConverter(typeof(ColorConverter))]
[Editor ("System.Drawing.Design.ColorEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
#endif
[Serializable]
public struct Color {
@@ -210,6 +210,7 @@ namespace System.Drawing {
0xFF316AC5, /* 174 - MenuHighlight */
};
#if !MONOTOUCH && !MONOMAC
static KnownColors ()
{
if (GDIPlus.RunningOnWindows ()) {
@@ -264,6 +265,7 @@ namespace System.Drawing {
ArgbValues [(int)KnownColor.MenuBar] = GetSysColor (GetSysColorIndex.COLOR_MENUBAR);
ArgbValues [(int)KnownColor.MenuHighlight] = GetSysColor (GetSysColorIndex.COLOR_MENUHIGHLIGHT);
}
#endif
public static Color FromKnownColor (KnownColor kc)
{
@@ -40,7 +40,9 @@ namespace System.Drawing
{
[Serializable]
[ComVisible (true)]
#if !MONOTOUCH && !MONOMAC
[TypeConverter (typeof (PointConverter))]
#endif
public struct Point
{
// Private x and y coordinate fields.
@@ -39,7 +39,9 @@ namespace System.Drawing
{
[Serializable]
[ComVisible (true)]
#if !MONOTOUCH && !MONOMAC
[TypeConverter (typeof (RectangleConverter))]
#endif
public struct Rectangle
{
private int x, y, width, height;
@@ -40,7 +40,9 @@ namespace System.Drawing
{
[Serializable]
[ComVisible (true)]
#if !MONOTOUCH && !MONOMAC
[TypeConverter (typeof (SizeConverter))]
#endif
public struct Size
{
@@ -40,7 +40,9 @@ namespace System.Drawing
{
[Serializable]
[ComVisible (true)]
#if !MONOTOUCH && !MONOMAC
[TypeConverter (typeof (SizeFConverter))]
#endif
public struct SizeF
{
// Private height and width fields.
@@ -33,7 +33,7 @@ using System.IO;
namespace System.Net.Http
{
public class HttpClient : HttpMessageInvoker
public partial class HttpClient : HttpMessageInvoker
{
static readonly TimeSpan TimeoutDefault = TimeSpan.FromSeconds (100);
@@ -44,10 +44,12 @@ namespace System.Net.Http
long buffer_size;
TimeSpan timeout;
#if !XAMARIN_MODERN
public HttpClient ()
: this (new HttpClientHandler (), true)
{
}
#endif
public HttpClient (HttpMessageHandler handler)
: this (handler, true)
@@ -469,8 +469,13 @@ namespace System.Runtime.Serialization
PrimitiveDataContract primitiveContract = PrimitiveDataContract.GetPrimitiveDataContract(memberType);
if (primitiveContract != null && !writeXsiType)
primitiveContract.XmlFormatContentWriterMethod.Invoke (writer, new object [] {memberValue});
else
InternalSerialize(XmlFormatGeneratorStatics.InternalSerializeMethod, () => memberValue, memberType, writeXsiType);
else {
// InternalSerialize(XmlFormatGeneratorStatics.InternalSerializeMethod, () => memberValue, memberType, writeXsiType);
var typeHandleValue = Type.GetTypeHandle (memberValue);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
}
}
else
{
@@ -500,22 +505,19 @@ namespace System.Runtime.Serialization
if (isNull2) {
XmlFormatGeneratorStatics.WriteNullMethod.Invoke (ctx, new object [] {writer, memberType, DataContract.IsTypeSerializable(memberType)});
} else {
InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod),
() => memberValue, memberType, writeXsiType);
var typeHandleValue = Type.GetTypeHandle (memberValue);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
if (isNullableOfT)
ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
else
ctx.InternalSerializeReference (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
//InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod), () => memberValue, memberType, writeXsiType);
}
}
}
}
}
void InternalSerialize (MethodInfo methodInfo, Func<object> memberValue, Type memberType, bool writeXsiType)
{
var v = memberValue ();
var typeHandleValue = Type.GetTypeHandle (v);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (v, memberType, Globals.TypeOfObject));
methodInfo.Invoke (ctx, new object [] {writer, memberValue != null ? v : null, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle});
}
object UnwrapNullableObject(Func<object> memberValue, ref Type memberType, out bool isNull)// Leaves !HasValue on stack
{
object v = memberValue ();
@@ -8,6 +8,7 @@ System.Runtime.Serialization/Bug2843Test.cs
System.Runtime.Serialization/Bug3258Test.cs
System.Runtime.Serialization/Bug242Test.cs
System.Runtime.Serialization/Bug695203Test.cs
System.Runtime.Serialization/Bug36100.cs
System.Runtime.Serialization/DataContractResolverTest.cs
System.Runtime.Serialization/DataContractSerializerTest_DuplicateQName.cs
System.Runtime.Serialization/DataContractSerializerTest_NullableWithDictionary.cs
Loaded 100 of 365 files, more files were not shown because too many files have changed in this diff. Show more