Alice

Secret key

Bob

Secret key

Alice

Alice's private key

Bob's public key

Bob

Bob's private key

Alice's public key

Alice

Hash the message, and encrypt the hash with the private key.

Alice's private key

Bob's public key

Bob

Decrypt the hash with Alice's public key, hash the message, and compare the decrypted hash with the message's hash to see if they match;
if yes, the message is intact and authentic.

Bob's private key

Alice's public key

Alice

Bob's public key

Alice's private key

` |`

`\|/`

Shared secret key

Bob

Alice's public key

Bob's private key

` |`

`\|/`

Shared secret key

TLS, the protocol that powers HTTPS, uses both asymmetric and symmetric encryption together: the first one to exchange secret keys, and the second one to encrypt messages.