What is the exact difference between the
CKM_RSA_X_509 mechanisms in the PKCS#11 v2.20 specification (Please explain with an example)?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
As very clearly indicated by the specification,
Both of these mechanisms are only building blocks for creating a signing algorithm. You won't get a valid PKCS#1 signature by supplying random data to either mechanism. These methods have been defined to give more control to the user of the mechanism.
Sometimes protocols such as older SSL specifications do use their own signature schemes (concatenating an MD5 and SHA-1 hash, leaving out the hash indicator). Those protocols cannot be supported without a direct implementation or lower level primitive being available.
Another reason that CKM_RSA_PKCS exist is that it may not be very efficient to perform the full PKCS#1 v1.5 signature generation on the security token. It is very inefficient to send an entire text document to a smart card. Just sending a hash structure calculated on the host computer is much faster.
A final note: you should never let an attacker be able to use