FileEncryptor1 1.0.0

dotnet add package FileEncryptor1 --version 1.0.0                
NuGet\Install-Package FileEncryptor1 -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FileEncryptor1" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FileEncryptor1 --version 1.0.0                
#r "nuget: FileEncryptor1, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FileEncryptor1 as a Cake Addin
#addin nuget:?package=FileEncryptor1&version=1.0.0

// Install FileEncryptor1 as a Cake Tool
#tool nuget:?package=FileEncryptor1&version=1.0.0                

FileEncryptor Package Usage

Overview

The FileEncryptor package provides functionality to encrypt and decrypt files using AES encryption. This guide demonstrates how to use the package in a simple console application.

Setup

  1. Create a Console Application: Start by creating a new console application in your development environment.

  2. Add the FileEncryptor Package: Make sure you have the FileEncryptor package referenced in your project.

Sample Code

Use the following code snippet in your Main method to demonstrate how to encrypt and decrypt a file.

using System;
using System.IO;

namespace FileEncryptorDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            string inputFilePath = @"C:\Path\To\Your\File.zip"; // Change to your file path
            string outputDirectory = @"C:\Path\To\Output"; // Change to your output directory

            // Ensure the output directory exists
            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }

            // Create an instance of the IFileEncryptor
            IFileEncryptor fileEncryptor = new FileEncryptor();

            // Encrypt the file
            string encryptedFilePath = Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(inputFilePath) + ".nbk");
            fileEncryptor.EncryptFile(inputFilePath, outputDirectory);
            Console.WriteLine($"File encrypted to: {encryptedFilePath}");

            // Decrypt the file
            string decryptedFilePath = Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(inputFilePath));
            fileEncryptor.DecryptFile(encryptedFilePath, outputDirectory);
            Console.WriteLine($"File decrypted to: {decryptedFilePath}");
        }
    }
}

## Explanation

- **File Paths**: Update the `inputFilePath` and `outputDirectory` variables to point to the actual file you want to encrypt and the directory where you want the output files to be saved.
  
- **Creating the Output Directory**: The code checks if the specified output directory exists and creates it if it doesn't.

- **Encrypting the File**: The `EncryptFile` method is called to encrypt the input file, and the encrypted file will be saved with a `.nbk` extension.

- **Decrypting the File**: The `DecryptFile` method is called to decrypt the previously encrypted file, restoring the original file extension.

## Notes

- Ensure the file paths are correct, and the input file exists.
- You may want to add error handling to manage exceptions, such as file not found or permission issues.
- This example assumes that the `FileEncryptor` class implements the `EncryptFile` and `DecryptFile` methods as previously discussed.

## Conclusion

This simple console application serves as a demonstration of how to use the `FileEncryptor` package for file encryption and decryption, showcasing the key functionalities you've implemented.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 79 10/21/2024