Add crypto entrypoint

This commit is contained in:
Bepis committed 2019-04-05 22:42:09 +11:00
1 parent f7bfd19855
commit 473c0e3b39
2 files changed
+35

No files matched your search

@@ -28,6 +28,7 @@
<Compile Include="Entrypoint.cs" />
<Compile Include="Linker.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RngEntrypoint.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BepInEx\BepInEx.csproj">
+34
View File
@@ -0,0 +1,34 @@
using System.Runtime.InteropServices;
using System.Security.Cryptography;
namespace BepInEx.Bootstrap
{
[ComVisible(true)]
public class RngEntrypoint : RandomNumberGenerator
{
private RNGCryptoServiceProvider InternalProvider { get; }
static RngEntrypoint()
{
Entrypoint.Init();
}
public RngEntrypoint()
=> InternalProvider = new RNGCryptoServiceProvider();
public RngEntrypoint(string str)
=> InternalProvider = new RNGCryptoServiceProvider(str);
public RngEntrypoint(byte[] rgb)
=> InternalProvider = new RNGCryptoServiceProvider(rgb);
public RngEntrypoint(CspParameters cspParams)
=> InternalProvider = new RNGCryptoServiceProvider(cspParams);
public override void GetBytes(byte[] data)
=> InternalProvider.GetBytes(data);
public override void GetNonZeroBytes(byte[] data)
=> InternalProvider.GetNonZeroBytes(data);
}
}