Aracılığıyla paylaş


Cipher.DoFinal Method

Definition

Overloads

DoFinal()

Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.

DoFinal(Byte[])

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

DoFinal(ByteBuffer, ByteBuffer)

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

DoFinal(Byte[], Int32)

Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.

DoFinal(Byte[], Int32, Int32)

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

DoFinal(Byte[], Int32, Int32, Byte[])

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

DoFinal(Byte[], Int32, Int32, Byte[], Int32)

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

DoFinal()

Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.

[Android.Runtime.Register("doFinal", "()[B", "")]
public byte[]? DoFinal ();
[<Android.Runtime.Register("doFinal", "()[B", "")>]
member this.DoFinal : unit -> byte[]

Returns

Byte[]

the new buffer with the result

Attributes

Exceptions

if the size of the resulting bytes is not a multiple of the cipher block size.

if the padding of the data does not match the padding scheme.

if this cipher instance is not initialized for encryption or decryption.

Remarks

Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.

Input data that may have been buffered during a previous update operation is processed, with padding (if requested) being applied. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in a new buffer.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Java documentation for javax.crypto.Cipher.doFinal().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DoFinal(Byte[])

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

[Android.Runtime.Register("doFinal", "([B)[B", "")]
public byte[]? DoFinal (byte[]? input);
[<Android.Runtime.Register("doFinal", "([B)[B", "")>]
member this.DoFinal : byte[] -> byte[]

Parameters

input
Byte[]

the input buffer

Returns

Byte[]

the new buffer with the result

Attributes

Exceptions

if the size of the resulting bytes is not a multiple of the cipher block size.

if the padding of the data does not match the padding scheme.

if this cipher instance is not initialized for encryption or decryption.

Remarks

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

The bytes in the input buffer, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in a new buffer.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Java documentation for javax.crypto.Cipher.doFinal(byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DoFinal(ByteBuffer, ByteBuffer)

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

[Android.Runtime.Register("doFinal", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", "")]
public int DoFinal (Java.Nio.ByteBuffer? input, Java.Nio.ByteBuffer? output);
[<Android.Runtime.Register("doFinal", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", "")>]
member this.DoFinal : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer -> int

Parameters

input
ByteBuffer

the input ByteBuffer

output
ByteBuffer

the output ByteBuffer

Returns

the number of bytes stored in output

Attributes

Exceptions

if the size of the output buffer is too small.

if the size of the resulting bytes is not a multiple of the cipher block size.

if the padding of the data does not match the padding scheme.

if the input buffer and the output buffer are the same object.

if this cipher instance is not initialized for encryption or decryption.

Remarks

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

All input.remaining() bytes starting at input.position() are processed. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in the output buffer. Upon return, the input buffer's position will be equal to its limit; its limit will not have changed. The output buffer's position will have advanced by n, where n is the value returned by this method; the output buffer's limit will not have changed.

If output.remaining() bytes are insufficient to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use #getOutputSize(int) getOutputSize to determine how big the output buffer should be.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Note: this method should be copy-safe, which means the input and output buffers can reference the same byte array and no unprocessed input data is overwritten when the result is copied into the output buffer.

Added in 1.5.

Java documentation for javax.crypto.Cipher.doFinal(java.nio.ByteBuffer, java.nio.ByteBuffer).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DoFinal(Byte[], Int32)

Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.

[Android.Runtime.Register("doFinal", "([BI)I", "")]
public int DoFinal (byte[]? output, int outputOffset);
[<Android.Runtime.Register("doFinal", "([BI)I", "")>]
member this.DoFinal : byte[] * int -> int

Parameters

output
Byte[]

the buffer for the result

outputOffset
Int32

the offset in output where the result is stored

Returns

the number of bytes stored in output

Attributes

Exceptions

if the size of the resulting bytes is not a multiple of the cipher block size.

if the size of the output buffer is too small.

if the padding of the data does not match the padding scheme.

if this cipher instance is not initialized for encryption or decryption.

Remarks

Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.

Input data that may have been buffered during a previous update operation is processed, with padding (if requested) being applied. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in the output buffer, starting at outputOffset inclusive.

If the output buffer is too small to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use #getOutputSize(int) getOutputSize to determine how big the output buffer should be.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Java documentation for javax.crypto.Cipher.doFinal(byte[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DoFinal(Byte[], Int32, Int32)

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

[Android.Runtime.Register("doFinal", "([BII)[B", "")]
public byte[]? DoFinal (byte[]? input, int inputOffset, int inputLen);
[<Android.Runtime.Register("doFinal", "([BII)[B", "")>]
member this.DoFinal : byte[] * int * int -> byte[]

Parameters

input
Byte[]

the input buffer

inputOffset
Int32

the offset in input where the input starts

inputLen
Int32

the input length

Returns

Byte[]

the new buffer with the result

Attributes

Exceptions

if the size of the resulting bytes is not a multiple of the cipher block size.

if the padding of the data does not match the padding scheme.

if this cipher instance is not initialized for encryption or decryption.

if inputOffset and inputLen do not specify an valid chunk in the input buffer.

Remarks

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

The first inputLen bytes in the input buffer, starting at inputOffset inclusive, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in a new buffer.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Java documentation for javax.crypto.Cipher.doFinal(byte[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DoFinal(Byte[], Int32, Int32, Byte[])

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

[Android.Runtime.Register("doFinal", "([BII[B)I", "")]
public int DoFinal (byte[]? input, int inputOffset, int inputLen, byte[]? output);
[<Android.Runtime.Register("doFinal", "([BII[B)I", "")>]
member this.DoFinal : byte[] * int * int * byte[] -> int

Parameters

input
Byte[]

the input buffer

inputOffset
Int32

the offset in input where the input starts

inputLen
Int32

the input length

output
Byte[]

the buffer for the result

Returns

the number of bytes stored in output

Attributes

Exceptions

if the size of the output buffer is too small.

if the size of the resulting bytes is not a multiple of the cipher block size.

if the padding of the data does not match the padding scheme.

if this cipher instance is not initialized for encryption or decryption.

if inputOffset and inputLen do not specify an valid chunk in the input buffer.

Remarks

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

The first inputLen bytes in the input buffer, starting at inputOffset inclusive, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in the output buffer.

If the output buffer is too small to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use #getOutputSize(int) getOutputSize to determine how big the output buffer should be.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Note: this method should be copy-safe, which means the input and output buffers can reference the same byte array and no unprocessed input data is overwritten when the result is copied into the output buffer.

Java documentation for javax.crypto.Cipher.doFinal(byte[], int, int, byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DoFinal(Byte[], Int32, Int32, Byte[], Int32)

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.

[Android.Runtime.Register("doFinal", "([BII[BI)I", "")]
public int DoFinal (byte[]? input, int inputOffset, int inputLen, byte[]? output, int outputOffset);
[<Android.Runtime.Register("doFinal", "([BII[BI)I", "")>]
member this.DoFinal : byte[] * int * int * byte[] * int -> int

Parameters

input
Byte[]

the input buffer

inputOffset
Int32

the offset in input where the input starts

inputLen
Int32

the input length

output
Byte[]

the buffer for the result

outputOffset
Int32

the offset in output where the result is stored

Returns

the number of bytes stored in output

Attributes

Exceptions

if the size of the output buffer is too small.

if the size of the resulting bytes is not a multiple of the cipher block size.

if the padding of the data does not match the padding scheme.

if this cipher instance is not initialized for encryption or decryption.

if inputOffset and inputLen do not specify an valid chunk in the input buffer.

Remarks

Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

The first inputLen bytes in the input buffer, starting at inputOffset inclusive, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. If an AEAD mode such as GCM/CCM is being used, the authentication tag is appended in the case of encryption, or verified in the case of decryption. The result is stored in the output buffer, starting at outputOffset inclusive.

If the output buffer is too small to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use #getOutputSize(int) getOutputSize to determine how big the output buffer should be.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to init. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to init) more data.

Note: if any exception is thrown, this cipher object may need to be reset before it can be used again.

Note: this method should be copy-safe, which means the input and output buffers can reference the same byte array and no unprocessed input data is overwritten when the result is copied into the output buffer.

Java documentation for javax.crypto.Cipher.doFinal(byte[], int, int, byte[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to