Question

What's the difference between these parameters? I've read the docs but I still doubt. Is it just the indexing rule (1..N vs 0..N-1) or anything else? I'd like to see a better explanation of these parameters if possible.

Was it helpful?

Solution

Disclaimer: This is my first experience learning about PKCS#11. This answer comes from reading docs for a few of the PKCS#11 wrappers listed on Wikipedia.

Correlating those docs with the Java API, I think slot (aka "Slot Id") is a slot identifier returned for a given slot within the list of slots returned by C_GetSlotList. slotListIndex appears to be the index into that list.

Mentally, I'm visualizing that C_GetSlotList would return a list such as:

Index    Id     Name
0        Foo    "Super Secure HSM"
1        Bar    "Awesome Card Reader"

In this case the "Awesome Card Reader" could be identified via slot = "Bar" or via slotListIndex = 1.

I think the confusing element here is that the API uses an integer for the Identifier, which is why it's hard to understand why it would be different from simply indexing into the list of slots.

In the end, it seems you'll need to get the slot list no matter what, so I don't think it matters which value you choose to identify the slot you're interested in.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top