Ridavei.FileCryption
1.0.2.3
Changing namespace and making a total rebuild of the project.
dotnet add package Ridavei.FileCryption --version 1.0.2.3
NuGet\Install-Package Ridavei.FileCryption -Version 1.0.2.3
<PackageReference Include="Ridavei.FileCryption" Version="1.0.2.3" />
<PackageVersion Include="Ridavei.FileCryption" Version="1.0.2.3" />
<PackageReference Include="Ridavei.FileCryption" />
paket add Ridavei.FileCryption --version 1.0.2.3
#r "nuget: Ridavei.FileCryption, 1.0.2.3"
#:package Ridavei.FileCryption@1.0.2.3
#addin nuget:?package=Ridavei.FileCryption&version=1.0.2.3
#tool nuget:?package=Ridavei.FileCryption&version=1.0.2.3
Ridavei.FileCryption
What is FileCryption?
Ridavei.FileCryption is a cross-platform library created to ease file decryption/encryption.
Examples in using FileCryption
File decryption
using System.IO;
using System.Net.Mime;
using Ridavei.FileCryption;
namespace TestProgram
{
class Program
{
public static void Main (string[] args)
{
ContentType contentType;
object fileInfo;
string password;
/*
Setting the variables above
*/
using (Stream decryptedFile = FileDecryptionBuilder
.CreateBuilder()
.SetFileLoaderMethod((object fileInfo) =>
{
//Return file as Stream
})
.AddDecryptionMethod(
contentType,
(Stream file, string password) =>
{
//Return decrypted Stream
})
.Decrypt(fileInfo, contentType, password))
{
//Saving the file
}
}
}
}
Simple file decryption
using System.IO;
using System.Net.Mime;
using Ridavei.FileCryption;
namespace TestProgram
{
class Program
{
public static void Main (string[] args)
{
ContentType contentType;
object fileInfo;
string password;
/*
Setting the variables above
*/
using (Stream decryptedFile = FileDecryptionBuilder
.CreateBuilder()
.SetFileLoaderMethod(FileLoaderMethod)
.AddDecryptionMethod(contentType, DecryptionMethod)
.Decrypt(fileInfo, contentType, password))
{
//Saving the file
}
}
private static Stream FileLoaderMethod(object fileInfo)
{
//Return file as Stream
}
private static Stream DecryptionMethod(Stream file, string password)
{
//Return decrypted Stream
}
}
}
Creating extensions
using System.IO;
using System.Net.Mime;
using Ridavei.FileCryption;
namespace TestProgram
{
//Extension for the base class
public static class FileLoaderExt
{
public static T UseFileLoaderExt<T>(this AFileCryptionBuilderBase<T> builder) where T : AFileCryptionBuilderBase<T>
{
builder.SetFileLoaderMethod((object filePath) =>
{
return new FileStream(filePath.ToString(), FileMode.Open, FileAccess.Read, FileShare.Read);
});
return (T)builder;
}
}
//Extension for the FileEncryptionBuilder class
public static class EncryptExt
{
public static FileEncryptionBuilder UseEncryptTxtExt(this FileEncryptionBuilder builder)
{
return builder.AddEncryptionMethod(new ContentType(MediaTypeNames.Text.Plain), EncryptTxt);
}
private static Stream EncryptTxt(Stream file, string password)
{
//Some magic
}
}
}
Simple file encryption using extensions from above
using System.IO;
using System.Net.Mime;
using Ridavei.FileCryption;
namespace TestProgram
{
class Program
{
public static void Main (string[] args)
{
ContentType contentType;
object fileInfo;
string password;
/*
Setting the variables above
*/
using (Stream decryptedFile = FileEncryptionBuilder
.CreateBuilder()
.UseFileLoaderExt()
.UseEncryptTxtExt()
.Encrypt(fileInfo, contentType, password))
{
//Saving the file
}
}
}
}
You can use many other encryption/decryption methods because they are added into a Dictionary. If you add a encryption/decryption method for a ContentType that already exists in the Dictionary it will overwrite the last one.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
| .NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 is compatible. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ridavei.FileCryption:
| Package | Downloads |
|---|---|
|
Ridavei.FileCryption.Loader.FileStream
Builder extension for loading file through FileStream for file decryption/encryption. |
GitHub repositories
This package is not used by any popular GitHub repositories.