The keys used are the two factors. Improvements in theory and technology continue to make the problem a little easier all the time. Anyone having access to the public key can check the integrity of the data, but only holders of the secret key can change the data. Obviously, this mechanism reduces the number of entities in a distributed system that need to know the secret key. Since the public key is common knowledge anyone can send a confidential message to a known recipient.
Integrity is achieved in the same way.
To obtain authentication of origin a second transformation needs to be applied. To provide this component the sender's secret key is used in a separate transformation of the data. Note that the actual secret used by the sender is not sent, only the effect of the secret which can be checked. Public key algorithms appear to have the advantage over secret key algorithms in that the secret key does not have to be known by every party in a communication. It also means the computer system can apply protection using the public key.