From a7bf2de9d8978ac016b5a634658e9b86c4010369 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Sun, 18 Oct 2015 17:11:21 -0400 Subject: Add support for .NET Core. Brings back filesystem-based operations --- .gitignore | 6 ++ BouncyCastle-PCL.sln | 10 ++- Portable.BouncyCastle.nuspec | 43 +++++++------ crypto/crypto.dotnet.csproj | 92 +++++++++++++++++++++++++++ crypto/crypto.dotnet.project.json | 17 +++++ crypto/crypto.pcl2.csproj | 8 --- crypto/packages.crypto.pcl2.config | 4 -- crypto/src/cms/CMSProcessableFile.cs | 2 +- crypto/src/openpgp/PgpLiteralDataGenerator.cs | 2 +- crypto/src/openpgp/PgpUtilities.cs | 6 +- 10 files changed, 152 insertions(+), 38 deletions(-) create mode 100644 crypto/crypto.dotnet.csproj create mode 100644 crypto/crypto.dotnet.project.json delete mode 100644 crypto/packages.crypto.pcl2.config 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 @@ bouncycastle, cryptography, encryption, security, PCL, wp8, wpa81, coreclr, dotnet, dnx, uwp, sl5, monotouch, monoandroid, xamarin, xamarin.ios - - - - + + + + + + - + - - - - - + + + + + - - - - - - - - - + + + + + + + + + + + + \ 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 @@ + + + + Local + 7.10.3077 + 2.0 + {38872A5F-E87E-4FAD-B109-8EB7B2E6A4A2} + Debug + AnyCPU + + + crypto + BouncyCastle.snk + JScript + Grid + IE50 + false + Library + crypto + OnBuildSuccess + + v5.0 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + 14.0 + + + + + bin\dotnet\Debug\ + obj\dotnet\Debug\ + false + 285212672 + false + + TRACE;DEBUG;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET + doc\dotnet\crypto.xml + true + 4096 + false + 1591 + false + false + false + false + 4 + full + prompt + + + bin\dotnet\Release\ + obj\dotnet\Release\ + false + 285212672 + false + + TRACE;PORTABLE;NO_THREADS;NEW_REFLECTION;SYS_RUNTIME;DOTNET + doc\dotnet\crypto.xml + true + 4096 + false + 1591 + true + false + false + false + 4 + pdbonly + prompt + + + true + + + + + + + + + + + + + + + + + + + \ 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 @@ - @@ -88,11 +87,4 @@ - - - - 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}. - - - \ 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 @@ - - - - \ 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 /// ///

/// Open a literal data packet for the passed in FileInfo 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 ///

Write out the passed in file as a literal data packet. 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 -- cgit 1.4.1