Szerkesztés

Megosztás a következőn keresztül:


AesGcm.Encrypt Method

Definition

Overloads

Encrypt(Byte[], Byte[], Byte[], Byte[], Byte[])

Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.

Encrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Span<Byte>, ReadOnlySpan<Byte>)

Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.

Encrypt(Byte[], Byte[], Byte[], Byte[], Byte[])

Source:
AesGcm.cs
Source:
AesGcm.cs
Source:
AesGcm.cs

Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.

public void Encrypt (byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = default);
public void Encrypt (byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[] associatedData = default);
member this.Encrypt : byte[] * byte[] * byte[] * byte[] * byte[] -> unit
Public Sub Encrypt (nonce As Byte(), plaintext As Byte(), ciphertext As Byte(), tag As Byte(), Optional associatedData As Byte() = Nothing)

Parameters

nonce
Byte[]

The nonce associated with this message, which should be a unique value for every operation with the same key.

plaintext
Byte[]

The content to encrypt.

ciphertext
Byte[]

The byte array to receive the encrypted contents.

tag
Byte[]

The byte array to receive the generated authentication tag.

associatedData
Byte[]

Extra data associated with this message, which must also be provided during decryption.

Exceptions

The plaintext parameter and the ciphertext do not have the same length.

-or-

The nonce parameter length is not permitted by NonceByteSizes.

-or-

The tag parameter length is not permitted by TagByteSizes.

The nonce, ciphertext, tag, or plaintext parameter is null.

The encryption operation failed.

Remarks

The security guarantees of the AES-GCM algorithm mode require that the same nonce value is never used twice with the same key.

Applies to

Encrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Span<Byte>, ReadOnlySpan<Byte>)

Source:
AesGcm.cs
Source:
AesGcm.cs
Source:
AesGcm.cs

Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.

public void Encrypt (ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> plaintext, Span<byte> ciphertext, Span<byte> tag, ReadOnlySpan<byte> associatedData = default);
member this.Encrypt : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * Span<byte> * ReadOnlySpan<byte> -> unit
Public Sub Encrypt (nonce As ReadOnlySpan(Of Byte), plaintext As ReadOnlySpan(Of Byte), ciphertext As Span(Of Byte), tag As Span(Of Byte), Optional associatedData As ReadOnlySpan(Of Byte) = Nothing)

Parameters

nonce
ReadOnlySpan<Byte>

The nonce associated with this message, which should be a unique value for every operation with the same key.

plaintext
ReadOnlySpan<Byte>

The content to encrypt.

ciphertext
Span<Byte>

The byte array to receive the encrypted contents.

tag
Span<Byte>

The byte array to receive the generated authentication tag.

associatedData
ReadOnlySpan<Byte>

Extra data associated with this message, which must also be provided during decryption.

Exceptions

The plaintext parameter and the ciphertext do not have the same length.

-or-

The nonce parameter length is not permitted by NonceByteSizes.

-or-

The tag parameter length is not permitted by TagByteSizes.

The encryption operation failed.

Remarks

The security guarantees of the AES-GCM algorithm mode require that the same nonce value is never used twice with the same key.

Applies to