private void checkCipherState(){
  if (!(this instanceof NullCipher)) {
    if (!initialized) {
      throw new IllegalStateException("Cipher not initialized");
    }
    if ((opmode != Cipher.ENCRYPT_MODE) && (opmode != Cipher.DECRYPT_MODE)) {
      throw new IllegalStateException("Cipher not initialized " + "for encryption/decryption");
    }
  }
}

private void checkCipherState ( ) { if ( ! ( this instanceof NullCipher ) ) { if ( ! initialized ) { throw new IllegalStateException ( "Cipher not initialized" ) ; } if ( ( opmode != Cipher . ENCRYPT_MODE ) && ( opmode != Cipher . DECRYPT_MODE ) ) { throw new IllegalStateException ( "Cipher not initialized " + "for encryption/decryption" ) ; } } }
ensures that cipher is in a valid state for update ( ) and dofinal ( ) calls - should be initialized and in encrypt_mode or decrypt_mode .
