mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 17:11:10 +00:00
28 lines
1.3 KiB
C#
28 lines
1.3 KiB
C#
#region ========================================================================= USING =====================================================================================
|
|
using System;
|
|
#endregion
|
|
|
|
namespace Lumina.Application.Common.Infrastructure.Security;
|
|
|
|
/// <summary>
|
|
/// Interface for the service for cryptographic concerns.
|
|
/// </summary>
|
|
public interface ICryptographyService
|
|
{
|
|
/// <summary>
|
|
/// Encrypts a plaintext string using AES encryption with a randomly generated initialization vector (IV).
|
|
/// </summary>
|
|
/// <param name="plaintext">The plaintext string to encrypt.</param>
|
|
/// <returns>A Base64-encoded string of the combined IV and encrypted ciphertext.</returns>
|
|
/// <exception cref="ArgumentException">Thrown when <paramref name="plaintext"/> is <see langword="null"/> or empty.</exception>
|
|
string Encrypt(string plaintext);
|
|
|
|
/// <summary>
|
|
/// Decrypts a Base64-encoded string that contains both the IV and ciphertext.
|
|
/// </summary>
|
|
/// <param name="ciphertext">The Base64-encoded string containing both IV and ciphertext.</param>
|
|
/// <returns>The decrypted plaintext string.</returns>
|
|
/// <exception cref="ArgumentException">Thrown when <paramref name="ciphertext"/> is <see langword="null"/>, empty, or invalid.</exception>
|
|
string Decrypt(string ciphertext);
|
|
}
|