What does CreateSignature(HashAlgorithm) achieve?

Viewed 13

I am working with some old code and I don't understand what has been done when creating a signed hash. The authors used this implementation:

AsymmetricSignatureFormatter.CreateSignature(HashAlgorithm)

All the examples I can find, and all the Microsoft documentation, use the other implementation:

AsymmetricSignatureFormatter.CreateSignature(byte[]HashedDataValue)

I understand that the second approach is signing a hash of some user data. At the receiver, we can re-hash the received plain text and compare it with this sent signed version to confirm it hasn't been changed. But what is the first approach trying to do? No signed data seems to be sent, only a signed version of 'the agorithm', but what actually gets signed? Does it sign the Hash.hash byte array? But if so, there is no plain text byte array at the receiver to re-hash and check the sent hash against. I suspect I have some fundamental misunderstanding of the purpose of this implementation.

0 Answers
Related