Update to README and project files

This commit is contained in:
Kim Laine 2019-10-30 10:20:52 -07:00
Родитель edd59fdb12
Коммит 0bde83135f
6 изменённых файлов: 33 добавлений и 33 удалений

Просмотреть файл

@ -1,5 +1,11 @@
# List of Changes # 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 ## Version 3.4.3
- Fixed bug in .NET serialization code where an incorrect number of bytes was written when using - Fixed bug in .NET serialization code where an incorrect number of bytes was written when using

Просмотреть файл

@ -110,6 +110,14 @@ the only choice.
# Installing Microsoft SEAL # 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 ## Windows
Microsoft SEAL comes with a Microsoft Visual Studio 2019 solution file `SEAL.sln` 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 `dotnet\lib\$(Configuration)\netcoreapp2.1`. The project takes care of copying the
native SEALNetNative library to the output directory. 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: To use Microsoft SEAL for .NET in your own application you need to:
1. add a reference in your project to `SEALNet.dll`; 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 way to ensure this is to copy `sealnetnative.dll` to the same directory where your
application's executable is located. application's executable is located.
Alternatively, you can build and use a NuGet package; see instructions in #### Building your own NuGet package
[NUGET.md](dotnet/nuget/NUGET.md). You can build your own NuGet package for Microsoft SEAL by following the instructions
in [NUGET.md](dotnet/nuget/NUGET.md).
## Linux and macOS ## Linux and macOS
@ -435,7 +444,7 @@ follow these
[instructions for installing in Linux](https://dotnet.microsoft.com/download?initial-os=linux), [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). 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, 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. you do not need to install the native shared library, you only need to compile it.
@ -458,12 +467,12 @@ make
cd ../.. cd ../..
```` ````
#### Building Microsoft SEAL for .NET #### .NET library
To build the .NET Standard library, do the following: To build the .NET Standard library, do the following:
```` ````
cd dotnet/src cd dotnet/src
dotnet build dotnet build --configuration <Debug|Release>
cd ../.. cd ../..
```` ````
You can use the `dotnet` parameter `--configuration <Debug|Release>` to build either You can use the `dotnet` parameter `--configuration <Debug|Release>` 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 assembly to be created in `dotnet/lib/$(Configuration)/netstandard2.0`. This assembly
is the one you will want to reference in your own projects. is the one you will want to reference in your own projects.
#### Building Examples #### .NET examples
To build and run the .NET examples, do: 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 <Debug|Release>` to output directory. You can use the `dotnet` parameter `--configuration <Debug|Release>` to
run either `Debug` or `Release` versions of the examples. run either `Debug` or `Release` versions of the examples.
#### Building Unit Tests #### .NET unit tests
To build and run the .NET unit tests, do: 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 to run `Debug` or `Relase` unit tests, and you can use `--verbosity detailed` to print the list
of unit tests that are being run. 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: To use Microsoft SEAL for .NET in your own application you need to:
1. add a reference in your project to `SEALNet.dll`; 1. add a reference in your project to `SEALNet.dll`;

Просмотреть файл

@ -11,26 +11,6 @@ namespace SEALNetExamples
{ {
static void Main(string[] args) 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) while (true)
{ {
Console.WriteLine("+---------------------------------------------------------+"); Console.WriteLine("+---------------------------------------------------------+");

Просмотреть файл

@ -19,8 +19,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<SEALNetNativeBinaryFiles Condition="'$(OS)' == 'Windows_NT'" Include="$(ProjectDir)../lib/x64/$(Configuration)/sealnetnative.*" /> <SEALNetNativeBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Windows))" Include="$(ProjectDir)../lib/x64/$(Configuration)/sealnetnative.dll" />
<SEALNetNativeBinaryFiles Condition="'$(OS)' == 'Unix'" Include="$(ProjectDir)../lib/libsealnetnative.*" /> <SEALNetNativeBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Linux))" Include="$(ProjectDir)../lib/libsealnetnative.so.*" />
<SEALNetNativeBinaryFiles Condition="$([MSBuild]::IsOsPlatform(OSX))" Include="$(ProjectDir)../lib/libsealnetnative.*.dylib" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

Просмотреть файл

@ -25,8 +25,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<SEALNetNativeBinaryFiles Condition="'$(OS)' == 'Windows_NT'" Include="$(ProjectDir)../lib/x64/$(Configuration)/sealnetnative.*" /> <SEALNetNativeBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Windows))" Include="$(ProjectDir)../lib/x64/$(Configuration)/sealnetnative.dll" />
<SEALNetNativeBinaryFiles Condition="'$(OS)' == 'Unix'" Include="$(ProjectDir)../lib/libsealnetnative.*" /> <SEALNetNativeBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Linux))" Include="$(ProjectDir)../lib/libsealnetnative.so.*" />
<SEALNetNativeBinaryFiles Condition="$([MSBuild]::IsOsPlatform(OSX))" Include="$(ProjectDir)../lib/libsealnetnative.*.dylib" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

Просмотреть файл

@ -315,6 +315,9 @@ if(SEAL_USE_ZLIB)
endif() endif()
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) if(SEAL_MULTIPLATFORM_NUGET_BUILD)
set(SEAL_WINDOWS_SEALNETNATIVE_PATH ../lib/x64/$Configuration$/sealnetnative.dll) set(SEAL_WINDOWS_SEALNETNATIVE_PATH ../lib/x64/$Configuration$/sealnetnative.dll)
set(SEAL_LINUX_SEALNETNATIVE_PATH ../lib/libsealnetnative.so.${SEAL_VERSION}) set(SEAL_LINUX_SEALNETNATIVE_PATH ../lib/libsealnetnative.so.${SEAL_VERSION})