From 0bde83135fd900b14a54b8fe60b3d8ab753a73d6 Mon Sep 17 00:00:00 2001 From: Kim Laine Date: Wed, 30 Oct 2019 10:20:52 -0700 Subject: [PATCH] Update to README and project files --- Changes.md | 6 ++++++ README.md | 27 +++++++++++++++++--------- dotnet/examples/Examples.cs | 20 ------------------- dotnet/examples/SEALNetExamples.csproj | 5 +++-- dotnet/tests/SEALNetTest.csproj | 5 +++-- native/src/CMakeLists.txt | 3 +++ 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Changes.md b/Changes.md index a4617328..528d0f73 100644 --- a/Changes.md +++ b/Changes.md @@ -1,5 +1,11 @@ # List of Changes +## Version 3.4.3 -- Hotfix + +- Fixed issues with `SEALNet.targets` file and `SEALNet.nuspec.in`. +- Updated `README.md` with information about existing multi-platform +[NuGet package](https://www.nuget.org/packages/Microsoft.Research.SEALNet). + ## Version 3.4.3 - Fixed bug in .NET serialization code where an incorrect number of bytes was written when using diff --git a/README.md b/README.md index 2952b9c9..7cb6fbec 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,14 @@ the only choice. # Installing Microsoft SEAL +## NuGet package for .NET developers +For .NET developers the easiest way of installing Microsoft SEAL is by using the +multi-platform NuGet package available at +[NuGet.org](https://www.nuget.org/packages/Microsoft.Research.SEALNet). Simply add +this package into your .NET project as a dependency and you are ready to go. However, +we still recommend reading through the below detailed installation instructions, as +they will explain how to build and run the examples that come with the source code. + ## Windows Microsoft SEAL comes with a Microsoft Visual Studio 2019 solution file `SEAL.sln` @@ -413,7 +421,7 @@ results in the `SEALNetTest.dll` assembly to be created in `dotnet\lib\$(Configuration)\netcoreapp2.1`. The project takes care of copying the native SEALNetNative library to the output directory. -### Using Microsoft SEAL for .NET in your own application +#### Using Microsoft SEAL for .NET in your own application To use Microsoft SEAL for .NET in your own application you need to: 1. add a reference in your project to `SEALNet.dll`; @@ -421,8 +429,9 @@ To use Microsoft SEAL for .NET in your own application you need to: way to ensure this is to copy `sealnetnative.dll` to the same directory where your application's executable is located. -Alternatively, you can build and use a NuGet package; see instructions in -[NUGET.md](dotnet/nuget/NUGET.md). +#### Building your own NuGet package +You can build your own NuGet package for Microsoft SEAL by following the instructions +in [NUGET.md](dotnet/nuget/NUGET.md). ## Linux and macOS @@ -435,7 +444,7 @@ follow these [instructions for installing in Linux](https://dotnet.microsoft.com/download?initial-os=linux), or for [installing in macOS](https://dotnet.microsoft.com/download?initial-os=macos). -### Local use of shared native library +#### Native library If you only intend to run the examples and unit tests provided with Microsoft SEAL, you do not need to install the native shared library, you only need to compile it. @@ -458,12 +467,12 @@ make cd ../.. ```` -#### Building Microsoft SEAL for .NET +#### .NET library To build the .NET Standard library, do the following: ```` cd dotnet/src -dotnet build +dotnet build --configuration cd ../.. ```` You can use the `dotnet` parameter `--configuration ` to build either @@ -471,7 +480,7 @@ a `Debug` or `Release` version of the assembly. This will result in a `SEALNet.d assembly to be created in `dotnet/lib/$(Configuration)/netstandard2.0`. This assembly is the one you will want to reference in your own projects. -#### Building Examples +#### .NET examples To build and run the .NET examples, do: ```` @@ -483,7 +492,7 @@ As mentioned before, the .NET project will copy the shared native library to the output directory. You can use the `dotnet` parameter `--configuration ` to run either `Debug` or `Release` versions of the examples. -#### Building Unit Tests +#### .NET unit tests To build and run the .NET unit tests, do: ```` @@ -495,7 +504,7 @@ All unit tests should pass. You can use the `dotnet` parameter `--configuration to run `Debug` or `Relase` unit tests, and you can use `--verbosity detailed` to print the list of unit tests that are being run. -### Using Microsoft SEAL for .NET +#### Using Microsoft SEAL for .NET in your own application To use Microsoft SEAL for .NET in your own application you need to: 1. add a reference in your project to `SEALNet.dll`; diff --git a/dotnet/examples/Examples.cs b/dotnet/examples/Examples.cs index b9408e45..f25d54b9 100644 --- a/dotnet/examples/Examples.cs +++ b/dotnet/examples/Examples.cs @@ -11,26 +11,6 @@ namespace SEALNetExamples { static void Main(string[] args) { - var parms = new EncryptionParameters(SchemeType.BFV); - parms.PolyModulusDegree = 4096; - parms.CoeffModulus = CoeffModulus.BFVDefault(4096); - parms.SetPlainModulus((1ul << 13) * 119 + 1); - var context = new SEALContext(parms); - SecretKey sk = new SecretKey(); - using (FileStream fs = new FileStream("sk.seal", FileMode.Open)) - { - sk.Load(context, fs); - } - Decryptor dec = new Decryptor(context, sk); - - Ciphertext ctxt = new Ciphertext(); - using (FileStream fs = new FileStream("ctxt.seal", FileMode.Open)) - { - ctxt.Load(context, fs); - } - - Console.WriteLine($"Noise budget: {dec.InvariantNoiseBudget(ctxt)}"); - while (true) { Console.WriteLine("+---------------------------------------------------------+"); diff --git a/dotnet/examples/SEALNetExamples.csproj b/dotnet/examples/SEALNetExamples.csproj index 77b2f794..bfc4231a 100644 --- a/dotnet/examples/SEALNetExamples.csproj +++ b/dotnet/examples/SEALNetExamples.csproj @@ -19,8 +19,9 @@ - - + + + diff --git a/dotnet/tests/SEALNetTest.csproj b/dotnet/tests/SEALNetTest.csproj index a6cb25b7..8e1f7e34 100644 --- a/dotnet/tests/SEALNetTest.csproj +++ b/dotnet/tests/SEALNetTest.csproj @@ -25,8 +25,9 @@ - - + + + diff --git a/native/src/CMakeLists.txt b/native/src/CMakeLists.txt index e9c662f4..02a8302b 100644 --- a/native/src/CMakeLists.txt +++ b/native/src/CMakeLists.txt @@ -315,6 +315,9 @@ if(SEAL_USE_ZLIB) endif() endif() +# Set the sealnetnative dynamic library file names to be included in creating +# the NuGet package. When building a multi-platform package, all three paths +# should be included. if(SEAL_MULTIPLATFORM_NUGET_BUILD) set(SEAL_WINDOWS_SEALNETNATIVE_PATH ../lib/x64/$Configuration$/sealnetnative.dll) set(SEAL_LINUX_SEALNETNATIVE_PATH ../lib/libsealnetnative.so.${SEAL_VERSION})