次の方法で共有


CipherSpi.EngineDoFinal Method

Definition

Overloads

EngineDoFinal(ByteBuffer, ByteBuffer)

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

EngineDoFinal(Byte[], Int32, Int32)

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

EngineDoFinal(Byte[], Int32, Int32, Byte[], Int32)

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

EngineDoFinal(ByteBuffer, ByteBuffer)

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

[Android.Runtime.Register("engineDoFinal", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", "GetEngineDoFinal_Ljava_nio_ByteBuffer_Ljava_nio_ByteBuffer_Handler")]
protected virtual int EngineDoFinal (Java.Nio.ByteBuffer? input, Java.Nio.ByteBuffer? output);
[<Android.Runtime.Register("engineDoFinal", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", "GetEngineDoFinal_Ljava_nio_ByteBuffer_Ljava_nio_ByteBuffer_Handler")>]
abstract member EngineDoFinal : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer -> int
override this.EngineDoFinal : Java.Nio.ByteBuffer * Java.Nio.ByteBuffer -> int

Parameters

input
ByteBuffer

the input ByteBuffer

output
ByteBuffer

the output ByteByffer

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.

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

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

Subclasses should consider overriding this method if they can process ByteBuffers more efficiently than byte arrays.

Added in 1.5.

Java documentation for javax.crypto.CipherSpi.engineDoFinal(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

EngineDoFinal(Byte[], Int32, Int32)

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

[Android.Runtime.Register("engineDoFinal", "([BII)[B", "GetEngineDoFinal_arrayBIIHandler")]
protected abstract byte[]? EngineDoFinal (byte[]? input, int inputOffset, int inputLen);
[<Android.Runtime.Register("engineDoFinal", "([BII)[B", "GetEngineDoFinal_arrayBIIHandler")>]
abstract member EngineDoFinal : 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.

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 engineInit. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to engineInit) 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.CipherSpi.engineDoFinal(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

EngineDoFinal(Byte[], Int32, Int32, Byte[], Int32)

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

[Android.Runtime.Register("engineDoFinal", "([BII[BI)I", "GetEngineDoFinal_arrayBIIarrayBIHandler")]
protected abstract int EngineDoFinal (byte[]? input, int inputOffset, int inputLen, byte[]? output, int outputOffset);
[<Android.Runtime.Register("engineDoFinal", "([BII[BI)I", "GetEngineDoFinal_arrayBIIarrayBIHandler")>]
abstract member EngineDoFinal : 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.

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.

Upon finishing, this method resets this cipher object to the state it was in when previously initialized via a call to engineInit. That is, the object is reset and available to encrypt or decrypt (depending on the operation mode that was specified in the call to engineInit) 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.CipherSpi.engineDoFinal(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