Understanding bitcoin-cli commands walletlock and walletpassphrase I am trying to understand two commands listed in the following link.

1. walletpassphrase

Stores the wallet decryption key in memory for &lt;timeout&gt; seconds.


2. walletlock

Removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked.


So if I am clear in my understanding, to encrypt my wallet I need to call the walletlockcommand and to decrypt it I need to call walletpassphrase command. Am I correct?
No, use encryptwallet to encrypt the wallet, read this document:

Examples:

Encrypt your wallet


  bitcoin-cli encryptwallet "my pass phrase"


Now set the passphrase to use the wallet, such as for signing or sending bitcoin


  bitcoin-cli walletpassphrase "my pass phrase"


Now we can do something like sign


  bitcoin-cli signmessage "address" "test message"


Now lock the wallet again by removing the passphrase


  bitcoin-cli walletlock