Cargo update error

I am getting the following message whenever I try cargo update:

  Updating crates.io index
warning: spurious network error (2 tries remaining): unknown certificate check failure; class=Net (12); code=Certificate (-17)
warning: spurious network error (1 tries remaining): unknown certificate check failure; class=Net (12); code=Certificate (-17)
error: failed to load source for a dependency on `rand`

Caused by:
  Unable to update registry `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  unknown certificate check failure; class=Net (12); code=Certificate (-17)

I have windows 10 and currently learning from the book. Thanks in advance.

This looks similar to this problem which affected Windows 7 and Windows 8 users, but that shouldn't happen on an up-to-date Windows 10 system.

What version of Rust are you using? Run rustc --version to check.

Is your computer's time and date set correctly?

rustc 1.39.0 (4560ea788 2019-11-04)
time and date is set correctly.
Will it matter if i am using a vpn?

If you get that when using VPN it may mean the VPN is trying to modify your traffic and/or spy on you.

tried using without vpn, still getting same error