Skip to content

Commit 8829566

Browse files
committed
to public api - its a nightmare to implement otherwise
1 parent 9e4a634 commit 8829566

File tree

5 files changed

+8
-19
lines changed

5 files changed

+8
-19
lines changed

src/DataProtection/Abstractions/src/IDataProtector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public interface IDataProtector : IDataProtectionProvider
3434
/// </summary>
3535
/// <param name="plainText">The plain text that will be encrypted later</param>
3636
/// <returns>The length of the encrypted data</returns>
37-
internal int GetProtectedSize(ReadOnlySpan<byte> plainText);
37+
int GetProtectedSize(ReadOnlySpan<byte> plainText);
3838

3939
/// <summary>
4040
/// Attempts to encrypt and tamper-proof a piece of data.
@@ -43,6 +43,6 @@ public interface IDataProtector : IDataProtectionProvider
4343
/// <param name="destination">The ciphertext blob, including authentication tag.</param>
4444
/// <param name="bytesWritten">When this method returns, the total number of bytes written into destination</param>
4545
/// <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);
46+
bool TryProtect(ReadOnlySpan<byte> plainText, Span<byte> destination, out int bytesWritten);
4747
#endif
4848
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
#nullable enable
2+
Microsoft.AspNetCore.DataProtection.IDataProtector.GetProtectedSize(System.ReadOnlySpan<byte> plainText) -> int
3+
Microsoft.AspNetCore.DataProtection.IDataProtector.TryProtect(System.ReadOnlySpan<byte> plainText, System.Span<byte> destination, out int bytesWritten) -> bool

src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorExtensions.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,6 @@ public static byte[] Encrypt(this IAuthenticatedEncryptor encryptor, ArraySegmen
3232
}
3333
}
3434

35-
#if NET10_0_OR_GREATER
36-
public static bool TryEncrypt(
37-
this IAuthenticatedEncryptor encryptor,
38-
ReadOnlySpan<byte> plaintext,
39-
ReadOnlySpan<byte> additionalAuthenticatedData,
40-
Span<byte> destination,
41-
int preBufferSize,
42-
int postBufferSize,
43-
out int bytesWritten)
44-
{
45-
var destinationBufferOffsets = destination.Slice(preBufferSize, destination.Length - (preBufferSize + postBufferSize));
46-
return encryptor.TryEncrypt(plaintext, additionalAuthenticatedData, destinationBufferOffsets, out bytesWritten);
47-
}
48-
#endif
49-
5035
/// <summary>
5136
/// Performs a self-test of this encryptor by running a sample payload through an
5237
/// encrypt-then-decrypt operation. Throws if the operation fails.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface IAuthenticatedEncryptor
3939
/// </summary>
4040
/// <param name="plainTextLength">Length of the plain text that will be encrypted later</param>
4141
/// <returns>The length of the encrypted data</returns>
42-
internal int GetEncryptedSize(int plainTextLength);
42+
int GetEncryptedSize(int plainTextLength);
4343

4444
/// <summary>
4545
/// Attempts to encrypt and tamper-proof a piece of data.
@@ -53,6 +53,6 @@ public interface IAuthenticatedEncryptor
5353
/// <param name="destination">The ciphertext blob, including authentication tag.</param>
5454
/// <param name="bytesWritten">When this method returns, the total number of bytes written into destination</param>
5555
/// <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);
56+
bool TryEncrypt(ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> additionalAuthenticatedData, Span<byte> destination, out int bytesWritten);
5757
#endif
5858
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
#nullable enable
2+
Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor.GetEncryptedSize(int plainTextLength) -> int
3+
Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor.TryEncrypt(System.ReadOnlySpan<byte> plaintext, System.ReadOnlySpan<byte> additionalAuthenticatedData, System.Span<byte> destination, out int bytesWritten) -> bool

0 commit comments

Comments
 (0)