RSACng.TryEncrypt Method

Definition

Encrypts data using the public key.

C#
public override bool TryEncrypt(ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.RSAEncryptionPadding padding, out int bytesWritten);

Parameters

data
ReadOnlySpan<Byte>

The data to encrypt.

destination
Span<Byte>

The buffer to receive the encrypted data.

padding
RSAEncryptionPadding

The padding mode.

bytesWritten
Int32

When this method returns, the total number of bytes written into destination. This parameter is treated as uninitialized.

Returns

true if destination is long enough to receive the encrypted data; otherwise, false.

Applies to

Produkt Verzie
.NET 7, 8, 9, 10