summary refs log tree commit diff
diff options
context:
space:
mode:
authorOren Novotny <oren@novotny.org>2015-10-18 17:11:21 -0400
committerOren Novotny <oren@novotny.org>2015-10-18 17:11:21 -0400
commita7bf2de9d8978ac016b5a634658e9b86c4010369 (patch)
tree8e2b7cc1d207355676a512306edc7838a8b11e3c
parentChange dotnet -> sys_runtime (diff)
downloadBouncyCastle.NET-ed25519-a7bf2de9d8978ac016b5a634658e9b86c4010369.tar.xz
Add support for .NET Core. Brings back filesystem-based operations
-rw-r--r--.gitignore6
-rw-r--r--BouncyCastle-PCL.sln10
-rw-r--r--Portable.BouncyCastle.nuspec43
-rw-r--r--crypto/crypto.dotnet.csproj92
-rw-r--r--crypto/crypto.dotnet.project.json17
-rw-r--r--crypto/crypto.pcl2.csproj8
-rw-r--r--crypto/packages.crypto.pcl2.config4
-rw-r--r--crypto/src/cms/CMSProcessableFile.cs2
-rw-r--r--crypto/src/openpgp/PgpLiteralDataGenerator.cs2
-rw-r--r--crypto/src/openpgp/PgpUtilities.cs6
10 files changed, 152 insertions, 38 deletions
diff --git a/.gitignore b/.gitignore
index 463d451b4..542f83c42 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,9 @@ _Resharper.*/
 _Resharper*/
 *.ide/
 packages/
+.vs/
+
+*.nuget.props
+*.nuget.targets
+*.project.lock.json
+project.lock.json
\ No newline at end of file
diff --git a/BouncyCastle-PCL.sln b/BouncyCastle-PCL.sln
index b834bda60..afd9396fa 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.31101.0
+# Visual Studio 14
+VisualStudioVersion = 14.0.24606.1
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{43196EF9-B75F-4ABB-8967-DAFD621A7D05}"
 	ProjectSection(SolutionItems) = preProject
@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.tests.Net45", "crypt
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.pcl2", "crypto\crypto.pcl2.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A1}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "crypto.dotnet", "crypto\crypto.dotnet.csproj", "{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
 		{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
+		{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2}.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 eb5b9bbf6..ce67ff6ba 100644
--- a/Portable.BouncyCastle.nuspec
+++ b/Portable.BouncyCastle.nuspec
@@ -35,31 +35,36 @@
     <tags>bouncycastle, cryptography, encryption, security, PCL, wp8, wpa81, coreclr, dotnet, dnx, uwp, sl5, monotouch, monoandroid, xamarin, xamarin.ios</tags>
     <dependencies>
       <group targetFramework="dotnet">
-        <dependency id="System.Collections" version="4.0.0" />
-        <dependency id="System.Diagnostics.Debug" version="4.0.0" />
-        <dependency id="System.Globalization" version="4.0.0" />
-        <dependency id="System.IO" version="4.0.0" />
+        <dependency id="System.Collections" version="4.0.10" />
+        <dependency id="System.Diagnostics.Debug" version="4.0.10" />
+        <dependency id="System.Globalization" version="4.0.10" />
+        <dependency id="System.IO" version="4.0.10" />
+        <dependency id="System.IO.FileSystem" version="4.0.0" />
+        <dependency id="System.IO.FileSystem.Primitives" version="4.0.0" />
         <dependency id="System.Linq" version="4.0.0" />
-        <dependency id="System.Reflection" version="4.0.0" />
+        <dependency id="System.Reflection" version="4.0.10" />
         <dependency id="System.Reflection.Extensions" version="4.0.0" />
-        <dependency id="System.Runtime" version="4.0.0" />
-        <dependency id="System.Runtime.Extensions" version="4.0.0" />
-        <dependency id="System.Text.Encoding" version="4.0.0" />
-        <dependency id="System.Threading" version="4.0.0" />
-        <dependency id="System.Threading.Tasks" version="4.0.0" />
+        <dependency id="System.Runtime" version="4.0.20" />
+        <dependency id="System.Runtime.Extensions" version="4.0.10" />
+        <dependency id="System.Text.Encoding" version="4.0.10" />
+        <dependency id="System.Threading" version="4.0.10" />
+        <dependency id="System.Threading.Tasks" version="4.0.10" />
       </group>
     </dependencies>
   </metadata>
   <files>
-    <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" />
-    <file src="Crypto\bin\pcl2\Release\crypto.xml" target="lib\dotnet" />
-    <file src="Crypto\bin\pcl2\Release\crypto.pdb" target="lib\dotnet" />
-    <file src="Crypto\bin\pcl2\Release\crypto.dll" target="lib\dotnet" />
+    <file src="Crypto\bin\pcl\Release\crypto.*" target="lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\portable-net45+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\net45" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\win8" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\wpa81" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\MonoTouch" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\MonoAndroid" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\XamarinMac" />
+    <file src="Crypto\bin\pcl2\Release\crypto.*" target="lib\XamarinIos" />
+    <file src="Crypto\bin\dotnet\Release\crypto.*" target="lib\dotnet" />
+    <file src="Crypto\bin\dotnet\Release\crypto.*" target="lib\uap10.0" />
+    <file src="Crypto\bin\dotnet\Release\crypto.*" target="lib\net46" />
   </files>
 </package>
\ No newline at end of file
diff --git a/crypto/crypto.dotnet.csproj b/crypto/crypto.dotnet.csproj
new file mode 100644
index 000000000..0c10e5744
--- /dev/null
+++ b/crypto/crypto.dotnet.csproj
@@ -0,0 +1,92 @@
+<?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-8EB7B2E6A4A2}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon />
+    <AssemblyKeyContainerName />
+    <AssemblyName>crypto</AssemblyName>
+    <AssemblyOriginatorKeyFile>BouncyCastle.snk</AssemblyOriginatorKeyFile>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <RootNamespace>crypto</RootNamespace>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <StartupObject />
+    <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <OutputPath>bin\dotnet\Debug\</OutputPath>
+    <IntermediateOutputPath>obj\dotnet\Debug\</IntermediateOutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile />
+    <DefineConstants>TRACE;DEBUG;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET</DefineConstants>
+    <DocumentationFile>doc\dotnet\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\dotnet\Release\</OutputPath>
+    <IntermediateOutputPath>obj\dotnet\Release\</IntermediateOutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile />
+    <DefineConstants>TRACE;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET</DefineConstants>
+    <DocumentationFile>doc\dotnet\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>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- NuSpec file must be specified as name does not match dll name -->
+    <NuSpecFile Include="$(SolutionDir)Portable.BouncyCastle.nuspec" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BouncyCastle.snk" />
+    <None Include="crypto.dotnet.project.json" />
+  </ItemGroup>
+  <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/crypto.dotnet.project.json b/crypto/crypto.dotnet.project.json
new file mode 100644
index 000000000..e80002612
--- /dev/null
+++ b/crypto/crypto.dotnet.project.json
@@ -0,0 +1,17 @@
+{
+  "supports": {
+    "net46.app": {},
+    "uwp.10.0.app": {},
+    "dnxcore50.app": {}
+  },
+  "dependencies": {
+    "Microsoft.NETCore": "5.0.0",
+    "Microsoft.NETCore.Portable.Compatibility": "1.0.0",
+    "NuSpec.ReferenceGenerator": "1.3.4"
+  },
+  "frameworks": {
+    "dotnet": {
+      "imports": "portable-net452+win81"
+    }
+  }
+}
\ No newline at end of file
diff --git a/crypto/crypto.pcl2.csproj b/crypto/crypto.pcl2.csproj
index 8d95bd0f6..62e76ee40 100644
--- a/crypto/crypto.pcl2.csproj
+++ b/crypto/crypto.pcl2.csproj
@@ -77,7 +77,6 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="BouncyCastle.snk" />
-    <None Include="packages.crypto.pcl2.config" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="src\**\*.cs" />
@@ -88,11 +87,4 @@
     <PreBuildEvent />
     <PostBuildEvent />
   </PropertyGroup>
-  <Import Project="..\packages\NuSpec.ReferenceGenerator.1.3.4\build\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NuSpec.ReferenceGenerator.targets" Condition="Exists('..\packages\NuSpec.ReferenceGenerator.1.3.4\build\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NuSpec.ReferenceGenerator.targets')" />
-  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
-    <PropertyGroup>
-      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
-    </PropertyGroup>
-    <Error Condition="!Exists('..\packages\NuSpec.ReferenceGenerator.1.3.4\build\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NuSpec.ReferenceGenerator.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuSpec.ReferenceGenerator.1.3.4\build\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NuSpec.ReferenceGenerator.targets'))" />
-  </Target>
 </Project>
\ No newline at end of file
diff --git a/crypto/packages.crypto.pcl2.config b/crypto/packages.crypto.pcl2.config
deleted file mode 100644
index 5cc160b36..000000000
--- a/crypto/packages.crypto.pcl2.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="NuSpec.ReferenceGenerator" version="1.3.4" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />
-</packages>
\ No newline at end of file
diff --git a/crypto/src/cms/CMSProcessableFile.cs b/crypto/src/cms/CMSProcessableFile.cs
index f7509fa7b..46f88cd9f 100644
--- a/crypto/src/cms/CMSProcessableFile.cs
+++ b/crypto/src/cms/CMSProcessableFile.cs
@@ -1,4 +1,4 @@
-#if !PORTABLE
+#if !PORTABLE || DOTNET
 using System;
 using System.IO;
 
diff --git a/crypto/src/openpgp/PgpLiteralDataGenerator.cs b/crypto/src/openpgp/PgpLiteralDataGenerator.cs
index 17a6eeef2..96078bf3e 100644
--- a/crypto/src/openpgp/PgpLiteralDataGenerator.cs
+++ b/crypto/src/openpgp/PgpLiteralDataGenerator.cs
@@ -141,7 +141,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 			return new WrappedGeneratorStream(this, pkOut);
 		}
 
-#if !PORTABLE
+#if !PORTABLE || DOTNET
 		/// <summary>
 		/// <p>
 		/// Open a literal data packet for the passed in <c>FileInfo</c> object, returning
diff --git a/crypto/src/openpgp/PgpUtilities.cs b/crypto/src/openpgp/PgpUtilities.cs
index f982ae459..fc85dac52 100644
--- a/crypto/src/openpgp/PgpUtilities.cs
+++ b/crypto/src/openpgp/PgpUtilities.cs
@@ -347,7 +347,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
             return MakeKey(algorithm, keyBytes);
         }
 
-#if !PORTABLE
+#if !PORTABLE || DOTNET
         /// <summary>Write out the passed in file as a literal data packet.</summary>
         public static void WriteFileToLiteralData(
             Stream		output,
@@ -382,8 +382,8 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
                 pOut.Write(buf, 0, len);
             }
 
-			pOut.Close();
-			inputStream.Close();
+			pOut.Dispose();
+			inputStream.Dispose();
 		}
 #endif