Cryptography and Encryption
In the wider world, cryptography is used for a variety of security related purposes:
Authentication (proof of identity, or proof of ownership)
Non-repudiation (author cannot later deny authorship of data)
Confidentiality (secrecy - third parties can't see the data)
Integrity (proof that data has not been changed or tampered with)...
Standard transactions are digitally signed using a private key. If a middle man tampers with the transaction, then the digital signature verification would fail, because the only way to produce a valid signature is to have the original private key. This would cause the transaction to fail and the network would reject it as invalid.
This signature algorithm ...
When you encrypt the wallet, only the private keys are actually being encrypted. You will be prompted to enter your encryption passphrase when the private keys are needed.
Public keys in the keypool, transaction information, and other metadata remain unencrypted because they are either public information or have no effect on the security of your Bitcoin. ...
Bitcoin Core 0.18.0 is compatible with any wallet version from 2017, if you want to check you can download any Bitcoin Core release. Bust most probably you are misspelling your password.
You could try also from the console. Use this command to decrypt it for 60 seconds:
In Bitcoin-Qt click Window -> Console.
walletpassphrase your-wallet-passphrase 60