joelhockey / jacknji11

Java Native Interface for PKCS#11
MIT License
32 stars 22 forks source link

Let HSM handle ATTRIBUTE_TYPE_INVALID and ATTRIBUTE_SENSITIVE as it should according to P11 #56

Closed primetomas closed 8 months ago

primetomas commented 8 months ago

Reading many attributes from different HSMs I noticed that JackNJI11 treats specifically ATTRIBUTE_TYPE_INVALID in a partly special way, but not completely. Carefully reading the PKCS#11 spec, and realized that the HSM (driver) must do this for us, so JackNJI11 should simply return an empty value if ATTRIBUTE_TYPE_INVALID or ATTRIBUTE_SENSITIVE. This patch fixes this.