Really, I'm asking how do you know who sent it?
My confusion has arisen from the following scenario...
Problems with Signing-then-encrypting.
If Alice digitally signed some data and then encrypted the data and the digital signature using Bob's public encryption key,
Bob could behave maliciously and...
1. decrypt and recover the data and the digital signature; 2. encrypt the data and the digital signature using Charlie's public encryption key; 3. send this ciphertext to Charlie, who decrypts it and verifies Alice's digital signature.
So Charlie can decrypt the message using his private key but how does he know what to do with the digital signature? How would he know what verification algorithm to use? How would he know who signed it?