-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathINameCrypt.cs
More file actions
31 lines (28 loc) · 1.46 KB
/
INameCrypt.cs
File metadata and controls
31 lines (28 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
namespace SecureFolderFS.Core.Cryptography.NameCrypt
{
/// <summary>
/// Represents an encryption method to encrypt and decrypt file and folder names.
/// </summary>
public interface INameCrypt : IDisposable
{
/// <summary>
/// Gets the encoding identifier.
/// </summary>
string EncodingId { get; }
/// <summary>
/// Encrypts the <paramref name="plaintextName"/> using associated <paramref name="directoryId"/>.
/// </summary>
/// <param name="plaintextName">The plaintext name to encrypt.</param>
/// <param name="directoryId">The Directory ID that the file name is a part of. Can accept <see cref="ReadOnlySpan{T}.Empty"/>.</param>
/// <returns>An encrypted ciphertext name.</returns>
string EncryptName(ReadOnlySpan<char> plaintextName, ReadOnlySpan<byte> directoryId);
/// <summary>
/// Decrypts the <paramref name="ciphertextName"/> using associated <paramref name="directoryId"/>.
/// </summary>
/// <param name="ciphertextName">The ciphertext name to encrypt.</param>
/// <param name="directoryId">The Directory ID that the file name is a part of. Can accept <see cref="ReadOnlySpan{T}.Empty"/>.</param>
/// <returns>If the name was successfully decrypted, returns a plaintext name; otherwise null.</returns>
string? DecryptName(ReadOnlySpan<char> ciphertextName, ReadOnlySpan<byte> directoryId);
}
}