Edit

Share via


Aes.TryDecryptKeyWrapPadded Method

Definition

Attempts to unwrap a key that was wrapped using the IETF RFC 5649 AES Key Wrap with Padding algorithm.

public:
 bool TryDecryptKeyWrapPadded(ReadOnlySpan<System::Byte> ciphertext, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public bool TryDecryptKeyWrapPadded(ReadOnlySpan<byte> ciphertext, Span<byte> destination, out int bytesWritten);
member this.TryDecryptKeyWrapPadded : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Function TryDecryptKeyWrapPadded (ciphertext As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parameters

ciphertext
ReadOnlySpan<Byte>

The data to unwrap.

destination
Span<Byte>

The buffer to receive the unwrapped key.

bytesWritten
Int32

When this method returns, contains the number of bytes written to destination.

This parameter is treated as uninitialized.

Returns

true if destination is long enough to receive the unwrapped key; otherwise, false.

Exceptions

ciphertext has a Length that does not correspond to the output of the Key Wrap with Padding algorithm.

ciphertext and destination overlap.

-or-

The unwrap algorithm failed to unwrap the ciphertext.

-or-

An error occurred during the cryptographic operation.

Applies to