Skip to content

Commit 9e4a634

Browse files
committed
hide in internal + docs
1 parent 18eec02 commit 9e4a634

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

src/DataProtection/Abstractions/src/IDataProtector.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,20 @@ public interface IDataProtector : IDataProtectionProvider
2929
byte[] Unprotect(byte[] protectedData);
3030

3131
#if NET10_0_OR_GREATER
32-
int GetProtectedSize(ReadOnlySpan<byte> plainText);
33-
bool TryProtect(ReadOnlySpan<byte> plainText, Span<byte> destination, out int bytesWritten);
32+
/// <summary>
33+
/// Returns the size of the encrypted data for a given plaintext length.
34+
/// </summary>
35+
/// <param name="plainText">The plain text that will be encrypted later</param>
36+
/// <returns>The length of the encrypted data</returns>
37+
internal int GetProtectedSize(ReadOnlySpan<byte> plainText);
38+
39+
/// <summary>
40+
/// Attempts to encrypt and tamper-proof a piece of data.
41+
/// </summary>
42+
/// <param name="plainText">The input to encrypt.</param>
43+
/// <param name="destination">The ciphertext blob, including authentication tag.</param>
44+
/// <param name="bytesWritten">When this method returns, the total number of bytes written into destination</param>
45+
/// <returns>true if destination is long enough to receive the encrypted data; otherwise, false.</returns>
46+
internal bool TryProtect(ReadOnlySpan<byte> plainText, Span<byte> destination, out int bytesWritten);
3447
#endif
3548
}

src/DataProtection/DataProtection/src/AuthenticatedEncryption/IAuthenticatedEncryptor.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,25 @@ public interface IAuthenticatedEncryptor
3434
byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData);
3535

3636
#if NET10_0_OR_GREATER
37-
int GetEncryptedSize(int plainTextLength);
38-
bool TryEncrypt(ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> additionalAuthenticatedData, Span<byte> destination, out int bytesWritten);
37+
/// <summary>
38+
/// Returns the size of the encrypted data for a given plaintext length.
39+
/// </summary>
40+
/// <param name="plainTextLength">Length of the plain text that will be encrypted later</param>
41+
/// <returns>The length of the encrypted data</returns>
42+
internal int GetEncryptedSize(int plainTextLength);
43+
44+
/// <summary>
45+
/// Attempts to encrypt and tamper-proof a piece of data.
46+
/// </summary>
47+
/// <param name="plaintext">The input to encrypt.</param>
48+
/// <param name="additionalAuthenticatedData">
49+
/// A piece of data which will not be included in
50+
/// the returned ciphertext but which will still be covered by the authentication tag.
51+
/// This input may be zero bytes in length. The same AAD must be specified in the corresponding decryption call.
52+
/// </param>
53+
/// <param name="destination">The ciphertext blob, including authentication tag.</param>
54+
/// <param name="bytesWritten">When this method returns, the total number of bytes written into destination</param>
55+
/// <returns>true if destination is long enough to receive the encrypted data; otherwise, false.</returns>
56+
internal bool TryEncrypt(ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> additionalAuthenticatedData, Span<byte> destination, out int bytesWritten);
3957
#endif
4058
}

0 commit comments

Comments
 (0)