code: public final byte[] doFinal(byte[] input)
              throws IllegalBlockSizeException, BadPaddingException {
          checkCipherState();
  
          // Input sanity check
          if (input == null) {
              throw new IllegalArgumentException("Null input buffer");
          }
  
          updateProviderIfNeeded();
          return spi.engineDoFinal(input, 0, input.length);
      }
docs: 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.
  
  <p>The bytes in the <code>input</code> buffer, and any input bytes that
  may have been buffered during a previous <code>update</code> 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.
  
  <p>Upon finishing, this method resets this cipher object to the state
  it was in when previously initialized via a call to <code>init</code>.
  That is, the object is reset and available to encrypt or decrypt
  (depending on the operation mode that was specified in the call to
  <code>init</code>) more data.
  
  <p>Note: if any exception is thrown, this cipher object may need to
  be reset before it can be used again.
  
  @param input the input buffer
  
  @return the new buffer with the result
  
  @exception IllegalStateException if this cipher is in a wrong state
  (e.g., has not been initialized)
  @exception IllegalBlockSizeException if this cipher is a block cipher,
  no padding has been requested (only in encryption mode), and the total
  input length of the data processed by this cipher is not a multiple of
  block size; or if this encryption algorithm is unable to
  process the input data provided.
  @exception BadPaddingException if this cipher is in decryption mode,
  and (un)padding has been requested, but the decrypted data is not
  bounded by the appropriate padding bytes
  @exception AEADBadTagException if this cipher is decrypting in an
  AEAD mode (such as GCM/CCM), and the received authentication tag
  does not match the calculated value