Skip to content

Commit 5f240c2

Browse files
committed
fix build
1 parent 8829566 commit 5f240c2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,10 @@ public bool TryProtect(ReadOnlySpan<byte> plaintext, Span<byte> destination, out
124124
// If the default key id has been updated since the last call to Protect, also write back the updated template.
125125
var aad = _aadTemplate.GetAadForKey(defaultKeyId, isProtecting: true);
126126

127-
var success = defaultEncryptorInstance.TryEncrypt(
128-
plaintext: plaintext,
129-
additionalAuthenticatedData: aad,
130-
destination: destination,
131-
preBufferSize: _magicHeaderKeyIdSize,
132-
postBufferSize: 0,
133-
out bytesWritten);
127+
var preBufferSize = _magicHeaderKeyIdSize;
128+
var postBufferSize = 0;
129+
var destinationBufferOffsets = destination.Slice(preBufferSize, destination.Length - (preBufferSize + postBufferSize));
130+
var success = defaultEncryptorInstance.TryEncrypt(plaintext, aad, destinationBufferOffsets, out bytesWritten);
134131

135132
// At this point: destination := { 000..000 || encryptorSpecificProtectedPayload },
136133
// where 000..000 is a placeholder for our magic header and key id.

0 commit comments

Comments
 (0)