certificatesingle-sign-onasymmetric

public/private key authentication and signing


I'm working on a Single Sign On solution to allow my company to integrate with other vendors.

As I'm doing my research, one thing is constantly confusing me.

My understanding of Public/Private key is that data is always encrypted with the vendor's public key and they decrypt using their private key. So far so good.

However, to validate that the message is really coming from me, I will compute the hash of the message and encrypt the hash with my private key (this process is also known as signing). To verify that the message is coming from me, the vendor will use my public key to decrypt the Hash and compare it with the unencrypted hash. If they match, the vendor can be confident that it came from me.

So how come my private key is used to encrypt the message..and how can public key decrypt the message? I thought Asymmetric keys doesn't allow that..! i.e Public Key always encrypts and private key always decrypts. Any explanations will be greatly appreciated..!


Solution

  • The difference between symmetric and asymmetric encryption is only the existence of private and public keys.

    Nevertheless in the common algorithms you can use the private key to encrypt messages which can be decrypted with the public key and you can also decrypt messages which are encrypted with the public key. So it is possible in both directions.