diff options
author | Oren Novotny <oren@novotny.org> | 2015-04-25 14:21:36 -0400 |
---|---|---|
committer | Oren Novotny <oren@novotny.org> | 2015-04-25 14:21:36 -0400 |
commit | f851a07eb16fe5fef480b8a5d041c04f16887851 (patch) | |
tree | 6e5f0c5bcbfe11f592395c3bfd5db372a412bbaa | |
parent | nuspec ver (diff) | |
download | BouncyCastle.NET-ed25519-f851a07eb16fe5fef480b8a5d041c04f16887851.tar.xz |
Add Sys.Runtime PCL
-rw-r--r-- | BouncyCastle-PCL.sln | 8 | ||||
-rw-r--r-- | Portable.BouncyCastle.nuspec | 10 | ||||
-rw-r--r-- | crypto/crypto.pcl.csproj | 10 | ||||
-rw-r--r-- | crypto/crypto.pcl2.csproj | 98 | ||||
-rw-r--r-- | crypto/src/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | crypto/src/crypto/prng/ThreadedSeedGenerator.cs | 8 | ||||
-rw-r--r-- | crypto/src/util/Enums.cs | 8 | ||||
-rw-r--r-- | crypto/src/util/TypeExtensions.cs | 18 |
8 files changed, 154 insertions, 10 deletions
diff --git a/BouncyCastle-PCL.sln b/BouncyCastle-PCL.sln index 4fcbb3fdf..b834bda60 100644 --- a/BouncyCastle-PCL.sln +++ b/BouncyCastle-PCL.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{43196EF9-B75F-4ABB-8967-DAFD621A7D05}" ProjectSection(SolutionItems) = preProject @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.pcl", "Crypto\crypto EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.tests.Net45", "crypto.tests.Net45\crypto.tests.Net45.csproj", "{45473847-8AF8-4BAF-B768-442C6875B8CE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.pcl2", "crypto\crypto.pcl2.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {45473847-8AF8-4BAF-B768-442C6875B8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {45473847-8AF8-4BAF-B768-442C6875B8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {45473847-8AF8-4BAF-B768-442C6875B8CE}.Release|Any CPU.Build.0 = Release|Any CPU + {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Portable.BouncyCastle.nuspec b/Portable.BouncyCastle.nuspec index d4174ec66..bdd9c6508 100644 --- a/Portable.BouncyCastle.nuspec +++ b/Portable.BouncyCastle.nuspec @@ -35,9 +35,13 @@ <tags>bouncycastle, cryptography, encryption, security, PCL, wp8, wpa81, net4, sl5, monotouch, monoandroid, xamarin, xamarin.ios</tags> </metadata> <files> - <file src="Crypto\bin\Release\crypto.xml" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.xml" /> - <file src="Crypto\bin\Release\crypto.pdb" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.pdb" /> - <file src="Crypto\bin\Release\crypto.dll" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.dll" /> + <file src="Crypto\bin\pcl\Release\crypto.xml" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.xml" /> + <file src="Crypto\bin\pcl\Release\crypto.pdb" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.pdb" /> + <file src="Crypto\bin\pcl\Release\crypto.dll" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.dll" /> <file src="Crypto\Readme.html" target="Readme.html" /> + + <file src="Crypto\bin\pcl2\Release\crypto.xml" target="lib\portable-net45+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.xml" /> + <file src="Crypto\bin\pcl2\Release\crypto.pdb" target="lib\portable-net45+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.pdb" /> + <file src="Crypto\bin\pcl2\Release\crypto.dll" target="lib\portable-net45+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.dll" /> </files> </package> \ No newline at end of file diff --git a/crypto/crypto.pcl.csproj b/crypto/crypto.pcl.csproj index 42d6e3024..be6ee7c59 100644 --- a/crypto/crypto.pcl.csproj +++ b/crypto/crypto.pcl.csproj @@ -45,13 +45,14 @@ <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <OutputPath>bin\Debug\</OutputPath> + <OutputPath>bin\pcl\Debug\</OutputPath> + <IntermediateOutputPath>obj\pcl\Debug\</IntermediateOutputPath> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> <BaseAddress>285212672</BaseAddress> <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> <ConfigurationOverrideFile /> <DefineConstants>TRACE;DEBUG;SILVERLIGHT;PCL</DefineConstants> - <DocumentationFile>doc\crypto.xml</DocumentationFile> + <DocumentationFile>doc\pcl\crypto.xml</DocumentationFile> <DebugSymbols>true</DebugSymbols> <FileAlignment>4096</FileAlignment> <NoStdLib>false</NoStdLib> @@ -65,13 +66,14 @@ <ErrorReport>prompt</ErrorReport> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <OutputPath>bin\Release\</OutputPath> + <OutputPath>bin\pcl\Release\</OutputPath> + <IntermediateOutputPath>obj\pcl\Release\</IntermediateOutputPath> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> <BaseAddress>285212672</BaseAddress> <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> <ConfigurationOverrideFile /> <DefineConstants>TRACE;SILVERLIGHT;PCL</DefineConstants> - <DocumentationFile>doc\crypto.xml</DocumentationFile> + <DocumentationFile>doc\pcl\crypto.xml</DocumentationFile> <DebugSymbols>true</DebugSymbols> <FileAlignment>4096</FileAlignment> <NoStdLib>false</NoStdLib> diff --git a/crypto/crypto.pcl2.csproj b/crypto/crypto.pcl2.csproj new file mode 100644 index 000000000..2dc9fd409 --- /dev/null +++ b/crypto/crypto.pcl2.csproj @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> + <PropertyGroup> + <ProjectType>Local</ProjectType> + <ProductVersion>7.10.3077</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}</ProjectGuid> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ApplicationIcon /> + <AssemblyKeyContainerName /> + <AssemblyName>crypto</AssemblyName> + <AssemblyOriginatorKeyFile /> + <DefaultClientScript>JScript</DefaultClientScript> + <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> + <DefaultTargetSchema>IE50</DefaultTargetSchema> + <DelaySign>false</DelaySign> + <OutputType>Library</OutputType> + <RootNamespace>crypto</RootNamespace> + <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> + <StartupObject /> + <FileUpgradeFlags> + </FileUpgradeFlags> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + <OldToolsVersion>12.0</OldToolsVersion> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TargetFrameworkProfile>Profile111</TargetFrameworkProfile> + <IsWebBootstrapper>false</IsWebBootstrapper> + <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <OutputPath>bin\pcl2\Debug\</OutputPath> + <IntermediateOutputPath>obj\pcl2\Debug\</IntermediateOutputPath> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <BaseAddress>285212672</BaseAddress> + <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> + <ConfigurationOverrideFile /> + <DefineConstants>TRACE;DEBUG;PCL;NEW_REFLECTION;NO_THREADS;SILVERLIGHT</DefineConstants> + <DocumentationFile>doc\pcl2\crypto.xml</DocumentationFile> + <DebugSymbols>true</DebugSymbols> + <FileAlignment>4096</FileAlignment> + <NoStdLib>false</NoStdLib> + <NoWarn>1591</NoWarn> + <Optimize>false</Optimize> + <RegisterForComInterop>false</RegisterForComInterop> + <RemoveIntegerChecks>false</RemoveIntegerChecks> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <WarningLevel>4</WarningLevel> + <DebugType>full</DebugType> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <OutputPath>bin\pcl2\Release\</OutputPath> + <IntermediateOutputPath>obj\pcl2\Release\</IntermediateOutputPath> + <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <BaseAddress>285212672</BaseAddress> + <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> + <ConfigurationOverrideFile /> + <DefineConstants>TRACE;PCL;NEW_REFLECTION;NO_THREADS;SILVERLIGHT</DefineConstants> + <DocumentationFile>doc\pcl2\crypto.xml</DocumentationFile> + <DebugSymbols>true</DebugSymbols> + <FileAlignment>4096</FileAlignment> + <NoStdLib>false</NoStdLib> + <NoWarn>1591</NoWarn> + <Optimize>true</Optimize> + <RegisterForComInterop>false</RegisterForComInterop> + <RemoveIntegerChecks>false</RemoveIntegerChecks> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <WarningLevel>4</WarningLevel> + <DebugType>pdbonly</DebugType> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <ItemGroup> + <Compile Include="src\**\*.cs" /> + <Compile Include="bzip2\**\*.cs" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent /> + <PostBuildEvent /> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/crypto/src/AssemblyInfo.cs b/crypto/src/AssemblyInfo.cs index fd1c8b87b..e7446b547 100644 --- a/crypto/src/AssemblyInfo.cs +++ b/crypto/src/AssemblyInfo.cs @@ -85,7 +85,11 @@ internal class AssemblyInfo { if (version == null) { +#if NEW_REFLECTION + var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).GetTypeInfo().Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute)).FirstOrDefault(); +#else var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false).FirstOrDefault(); +#endif if (ver != null) { version = ver.Version; diff --git a/crypto/src/crypto/prng/ThreadedSeedGenerator.cs b/crypto/src/crypto/prng/ThreadedSeedGenerator.cs index a6c1a4ad3..6aab16b70 100644 --- a/crypto/src/crypto/prng/ThreadedSeedGenerator.cs +++ b/crypto/src/crypto/prng/ThreadedSeedGenerator.cs @@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Crypto.Prng int numBytes, bool fast) { -#if SILVERLIGHT +#if SILVERLIGHT || NO_THREADS return DoGenerateSeed(numBytes, fast); #else ThreadPriority originalPriority = Thread.CurrentThread.Priority; @@ -62,7 +62,11 @@ namespace Org.BouncyCastle.Crypto.Prng int last = 0; int end = fast ? numBytes : numBytes * 8; - ThreadPool.QueueUserWorkItem(new WaitCallback(Run)); +#if NO_THREADS + Task.Run(() => Run(null)); +#else + ThreadPool.QueueUserWorkItem(new WaitCallback(Run)); +#endif for (int i = 0; i < end; i++) { diff --git a/crypto/src/util/Enums.cs b/crypto/src/util/Enums.cs index d943acdd3..0a3d1e56a 100644 --- a/crypto/src/util/Enums.cs +++ b/crypto/src/util/Enums.cs @@ -14,7 +14,11 @@ namespace Org.BouncyCastle.Utilities { internal static Enum GetEnumValue(System.Type enumType, string s) { +#if NEW_REFLECTION + if (!enumType.GetTypeInfo().IsEnum) +#else if (!enumType.IsEnum) +#endif throw new ArgumentException("Not an enumeration type", "enumType"); // We only want to parse single named constants @@ -39,7 +43,11 @@ namespace Org.BouncyCastle.Utilities internal static Array GetEnumValues(System.Type enumType) { +#if NEW_REFLECTION + if(!enumType.GetTypeInfo().IsEnum) +#else if (!enumType.IsEnum) +#endif throw new ArgumentException("Not an enumeration type", "enumType"); #if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT && !PCL diff --git a/crypto/src/util/TypeExtensions.cs b/crypto/src/util/TypeExtensions.cs new file mode 100644 index 000000000..c7ce807a0 --- /dev/null +++ b/crypto/src/util/TypeExtensions.cs @@ -0,0 +1,18 @@ +using System; +using System.Reflection; + +#if NEW_REFLECTION + +namespace Org.BouncyCastle +{ + internal static class TypeExtensions + { + public static bool IsInstanceOfType(this Type type, object instance) + { + return instance != null && type.GetTypeInfo().IsAssignableFrom(instance.GetType().GetTypeInfo()); + } + } + +} + +#endif \ No newline at end of file |