Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b1a4b40
implement encrypt size calculation
DeagleGross Jul 15, 2025
aecf589
implement geteencyrptedsize
DeagleGross Jul 16, 2025
198501e
try encrypt
DeagleGross Jul 16, 2025
a4e3ca4
simplify net10 impl
DeagleGross Jul 16, 2025
8d49973
simplify tests and cbc
DeagleGross Jul 16, 2025
ae6fb76
cnggcm
DeagleGross Jul 16, 2025
9caa72e
aes
DeagleGross Jul 16, 2025
b9b45b2
something
DeagleGross Jul 16, 2025
b3e5b42
key ring based part
DeagleGross Jul 16, 2025
4eb96e3
Merge branch 'main' into dmkorolev/dataprotector-spans
DeagleGross Jul 23, 2025
afd344c
refactor
DeagleGross Jul 24, 2025
fd7f929
finally passed!
DeagleGross Jul 24, 2025
afbad47
generate test for plain text
DeagleGross Jul 24, 2025
34d52e7
correct empty plain text scenario
DeagleGross Jul 24, 2025
18eec02
minor improvements
DeagleGross Jul 24, 2025
9e4a634
hide in internal + docs
DeagleGross Jul 24, 2025
8829566
to public api - its a nightmare to implement otherwise
DeagleGross Jul 24, 2025
5f240c2
fix build
DeagleGross Jul 24, 2025
8d275ac
wip
DeagleGross Jul 24, 2025
8f5b762
re-review
DeagleGross Jul 24, 2025
efd4f79
implement timelimitedDataProtector
DeagleGross Jul 24, 2025
6142309
introduce `IOptimizedDataProtector`
DeagleGross Jul 25, 2025
ae5bb82
introduce optimized IAuthenticatedEncryptor
DeagleGross Jul 25, 2025
0646d1a
fix dataprotector usage
DeagleGross Jul 25, 2025
3d37955
fix build?
DeagleGross Jul 25, 2025
bbfce53
move to a separate ISpanAuthenticatedEncryptor
DeagleGross Jul 25, 2025
b0fc525
refactor to ISpan interfaces
DeagleGross Jul 28, 2025
d4b1fc9
correct span allocation
DeagleGross Jul 28, 2025
146af98
use TryEncrypt from Encrypt()
DeagleGross Jul 28, 2025
630e451
fix
DeagleGross Jul 28, 2025
983b69f
Merge branch 'main' into dmkorolev/dataprotector-spans
DeagleGross Jul 31, 2025
948052c
init
DeagleGross Aug 1, 2025
37a3277
inheritance!
DeagleGross Aug 2, 2025
0e1dfd6
separate impl
DeagleGross Aug 2, 2025
35f7522
distinguish impl
DeagleGross Aug 2, 2025
05fdcc3
other impls
DeagleGross Aug 3, 2025
f223b45
tests & api
DeagleGross Aug 3, 2025
c029655
init decrypt
DeagleGross Aug 3, 2025
fe478d2
cnggcm
DeagleGross Aug 4, 2025
72aecba
init cbc
DeagleGross Aug 4, 2025
29e7622
cbc
DeagleGross Aug 4, 2025
516729c
mockable
DeagleGross Aug 4, 2025
21b7d87
AesGcm
DeagleGross Aug 4, 2025
5a1ea5c
impl managed
DeagleGross Aug 4, 2025
f561796
fix slices everywhere + rollback managedauth to a proper impl
DeagleGross Aug 4, 2025
c1b203f
ispanauth: decryption ready
DeagleGross Aug 4, 2025
614b569
intro ispandataprotector.unprotect \ fix warnings \ dont change timel…
DeagleGross Aug 5, 2025
9f24867
span data protector unprotect
DeagleGross Aug 6, 2025
27f7609
"final" review
DeagleGross Aug 6, 2025
e3726ec
avoid blank lines!
DeagleGross Aug 6, 2025
bc44688
push project for microbenchmarks
DeagleGross Aug 6, 2025
57e9f85
Merge branch 'main' into dmkorolev/dataprotector-spans
DeagleGross Sep 12, 2025
4eadb9b
PR review comments + check length upfront
DeagleGross Sep 12, 2025
e6d0d0a
fix warnings
DeagleGross Oct 9, 2025
41c2163
fix warnings in benchmarks
DeagleGross Oct 9, 2025
bf9537a
fix build?
DeagleGross Oct 27, 2025
77dd694
rollback benchmark changes
DeagleGross Oct 27, 2025
97db08b
init + cbc + mock
DeagleGross Nov 5, 2025
edada0c
cng gcm
DeagleGross Nov 5, 2025
1c16e20
aes gcm
DeagleGross Nov 5, 2025
cef12f0
encryptors
DeagleGross Nov 5, 2025
96b8d93
change
DeagleGross Nov 6, 2025
400ec6d
fixes / tests / etc
DeagleGross Nov 6, 2025
d309725
nit
DeagleGross Nov 6, 2025
05e3dde
reimplement with "ref"
DeagleGross Nov 6, 2025
ccb4bc8
diff!
DeagleGross Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion AspNetCore.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
<Project Path="src/DataProtection/Abstractions/src/Microsoft.AspNetCore.DataProtection.Abstractions.csproj" />
<Project Path="src/DataProtection/Abstractions/test/Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj" />
</Folder>
<Folder Name="/src/DataProtection/benchmarks/">
<Project Path="src/DataProtection/benchmarks/Microsoft.AspNetCore.DataProtection.MicroBenchmarks/Microsoft.AspNetCore.DataProtection.MicroBenchmarks.csproj" />
</Folder>
<Folder Name="/src/DataProtection/Cryptography.Internal/">
<Project Path="src/DataProtection/Cryptography.Internal/src/Microsoft.AspNetCore.Cryptography.Internal.csproj" />
<Project Path="src/DataProtection/Cryptography.Internal/test/Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj" />
Expand Down Expand Up @@ -1143,6 +1146,7 @@
<Project Path="src/SignalR/server/StackExchangeRedis/src/Microsoft.AspNetCore.SignalR.StackExchangeRedis.csproj" />
<Project Path="src/SignalR/server/StackExchangeRedis/test/Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests.csproj" />
</Folder>
<Folder Name="/src/SiteExtensions/" />
<Folder Name="/src/SiteExtensions/Microsoft.Web.Xdt.Extensions/">
<Project Path="src/SiteExtensions/Microsoft.Web.Xdt.Extensions/src/Microsoft.Web.Xdt.Extensions.csproj" />
<Project Path="src/SiteExtensions/Microsoft.Web.Xdt.Extensions/tests/Microsoft.Web.Xdt.Extensions.Tests.csproj" />
Expand Down Expand Up @@ -1190,8 +1194,8 @@
<Project Path="src/Validation/src/Microsoft.Extensions.Validation.csproj" />
</Folder>
<Folder Name="/src/Validation/test/">
<Project Path="src/Validation/test/Microsoft.Extensions.Validation.Tests/Microsoft.Extensions.Validation.Tests.csproj" />
<Project Path="src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/Microsoft.Extensions.Validation.GeneratorTests.csproj" />
<Project Path="src/Validation/test/Microsoft.Extensions.Validation.Tests/Microsoft.Extensions.Validation.Tests.csproj" />
</Folder>
<Folder Name="/src/WebEncoders/">
<Project Path="src/WebEncoders/src/Microsoft.Extensions.WebEncoders.csproj" />
Expand Down
56 changes: 56 additions & 0 deletions src/DataProtection/Abstractions/src/ISpanDataProtector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.AspNetCore.DataProtection;

/// <summary>
/// An interface that can provide data protection services.
/// Is an optimized version of <see cref="IDataProtector"/>.
/// </summary>
public interface ISpanDataProtector : IDataProtector
{
/// <summary>
/// Cryptographically protects a piece of plaintext data and writes the result to a buffer writer.
/// </summary>
/// <typeparam name="TWriter">The type of buffer writer to write the protected data to.</typeparam>
/// <param name="plaintext">The plaintext data to protect.</param>
/// <param name="destination">The buffer writer to which the protected data will be written.</param>
/// <remarks>
/// This method provides an optimized, streaming alternative to <see cref="IDataProtector.Protect(byte[])"/>.
/// Rather than allocating an intermediate buffer, the protected data is written directly to the provided
/// buffer writer, which can improve performance and reduce memory allocation pressure.
/// The buffer writer is advanced by the total number of bytes written to it.
/// </remarks>
void Protect<TWriter>(ReadOnlySpan<byte> plaintext, ref TWriter destination)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 31 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L31

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(31,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Protect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
where TWriter : IBufferWriter<byte>
#if NET
, allows ref struct
#endif
;

/// <summary>
/// Cryptographically unprotects a piece of protected data and writes the result to a buffer writer.
/// </summary>
/// <typeparam name="TWriter">The type of buffer writer to write the unprotected data to.</typeparam>
/// <param name="protectedData">The protected data to unprotect.</param>
/// <param name="destination">The buffer writer to which the unprotected plaintext will be written.</param>
/// <remarks>
/// This method provides an optimized, streaming alternative to <see cref="IDataProtector.Unprotect(byte[])"/>.
/// Rather than allocating an intermediate buffer, the unprotected plaintext is written directly to the provided
/// buffer writer, which can improve performance and reduce memory allocation pressure.
/// The buffer writer is advanced by the total number of bytes written to it.
/// </remarks>
void Unprotect<TWriter>(ReadOnlySpan<byte> protectedData, ref TWriter destination)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 50 in src/DataProtection/Abstractions/src/ISpanDataProtector.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/DataProtection/Abstractions/src/ISpanDataProtector.cs#L50

src/DataProtection/Abstractions/src/ISpanDataProtector.cs(50,10): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Unprotect<TWriter>' is not part of the declared API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
where TWriter : IBufferWriter<byte>
#if NET
, allows ref struct
#endif
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Microsoft.AspNetCore.DataProtection.IDataProtector</Description>
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != '$(DefaultNetCoreTargetFramework)'">
<Reference Include="System.Memory" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.AspNetCore.DataProtection.Abstractions.Tests" />
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#nullable enable
Microsoft.AspNetCore.DataProtection.ISpanDataProtector
Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 3 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L3

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(3,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Protect<TWriter>(System.ReadOnlySpan<byte> plaintext, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Check failure on line 4 in src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt#L4

src/DataProtection/Abstractions/src/PublicAPI.Unshipped.txt(4,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.AspNetCore.DataProtection.ISpanDataProtector.Unprotect<TWriter>(System.ReadOnlySpan<byte> protectedData, TWriter destination) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
1 change: 1 addition & 0 deletions src/DataProtection/DataProtection.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"src\\DataProtection\\Extensions\\test\\Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj",
"src\\DataProtection\\StackExchangeRedis\\src\\Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj",
"src\\DataProtection\\StackExchangeRedis\\test\\Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj",
"src\\DataProtection\\benchmarks\\Microsoft.AspNetCore.DataProtection.MicroBenchmarks\\Microsoft.AspNetCore.DataProtection.MicroBenchmarks.csproj",
"src\\DataProtection\\samples\\CustomEncryptorSample\\CustomEncryptorSample.csproj",
"src\\DataProtection\\samples\\EntityFrameworkCoreSample\\EntityFrameworkCoreSample.csproj",
"src\\DataProtection\\samples\\KeyManagementSample\\KeyManagementSample.csproj",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;

/// <summary>
/// Provides an authenticated encryption and decryption routine via a span-based API.
/// </summary>
public interface ISpanAuthenticatedEncryptor : IAuthenticatedEncryptor
{
/// <summary>
/// Encrypts and authenticates a piece of plaintext data and writes the result to a buffer writer.
/// </summary>
/// <typeparam name="TWriter">The type of buffer writer to write the ciphertext to.</typeparam>
/// <param name="plaintext">The plaintext to encrypt. This input may be zero bytes in length.</param>
/// <param name="additionalAuthenticatedData">
/// A piece of data which will not be included in the returned ciphertext
/// but which will still be covered by the authentication tag. This input may be zero bytes in length.
/// The same AAD must be specified in the corresponding call to <see cref="Decrypt{TWriter}"/>.
/// </param>
/// <param name="destination">The buffer writer to which the ciphertext (including authentication tag) will be written.</param>
/// <remarks>
/// This method provides an optimized, streaming alternative to <see cref="IAuthenticatedEncryptor.Encrypt(System.ArraySegment{byte}, System.ArraySegment{byte})"/>.
/// Rather than allocating an intermediate buffer, the ciphertext is written directly to the provided buffer writer,
/// which can improve performance and reduce memory allocation pressure.
/// The buffer writer is advanced by the total number of bytes written to it.
/// </remarks>
void Encrypt<TWriter>(ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> additionalAuthenticatedData, ref TWriter destination)
where TWriter : IBufferWriter<byte>
#if NET
, allows ref struct
#endif
;

/// <summary>
/// Validates the authentication tag of and decrypts a blob of encrypted data, writing the result to a buffer writer.
/// </summary>
/// <typeparam name="TWriter">The type of buffer writer to write the plaintext to.</typeparam>
/// <param name="ciphertext">The ciphertext (including authentication tag) to decrypt.</param>
/// <param name="additionalAuthenticatedData">
/// Any ancillary data which was used during computation of the authentication tag.
/// The same AAD must have been specified in the corresponding call to <see cref="Encrypt{TWriter}"/>.
/// </param>
/// <param name="destination">The buffer writer to which the decrypted plaintext will be written.</param>
/// <remarks>
/// This method provides an optimized, streaming alternative to <see cref="IAuthenticatedEncryptor.Decrypt(System.ArraySegment{byte}, System.ArraySegment{byte})"/>.
/// Rather than allocating an intermediate buffer, the plaintext is written directly to the provided buffer writer,
/// which can improve performance and reduce memory allocation pressure.
/// The buffer writer is advanced by the total number of bytes written to it.
/// </remarks>
void Decrypt<TWriter>(ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> additionalAuthenticatedData, ref TWriter destination)
where TWriter : IBufferWriter<byte>
#if NET
, allows ref struct
#endif
;
}
Loading
Loading