Creating SmartCardHSMKeyStore Results In Null Pointer Exception

I have a JAVA application which runs in windows and interacts with a Nitro HSM Key. However, when access to a key store is attempted, it results in a null pointer exception.

Setup provider as:

SmartCardHSMProvider p = new de.cardcontact.smartcardhsmprovider.SmartCardHSMProvider();

Create the keystore:

KeyStore hsm = KeyStore.getInstance(“SmartCardHSMKeyStore”);

Results in:

Exception in thread “main” java.lang.reflect.InvocationTargetException
at de.cardcontact.smartcardhsmprovider.SmartCardHSMProvider$SCHSMService.newInstance(
at Source)
at Source)
at Source)
at Source)
at com.fcs.j2se.loader.Loader.main(
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at de.cardcontact.smartcardhsmprovider.SmartCardHSMProvider$SCHSMService.newInstance(
… 5 more
Caused by: java.lang.NullPointerException
at java.lang.String.startsWith(Unknown Source)
at java.lang.String.startsWith(Unknown Source)
at opencard.core.terminal.CardTerminalRegistry.cardTerminalForName(
at de.cardcontact.smartcardhsmprovider.SmartCardHSMProvider.cardInserted(
at opencard.core.event.EventGenerator.createEventsForPresentCards(
at de.cardcontact.smartcardhsmprovider.SmartCardHSMProvider.checkCardState(
at de.cardcontact.smartcardhsmprovider.SmartCardHSMProvider.getSmartCardHSMCardService(
at de.cardcontact.smartcardhsmprovider.SmartCardHSMKeyStore.(
… 10 more

If the following code is run:

    CardTerminalRegistry r = CardTerminalRegistry.getRegistry();
    Enumeration<CardTerminal> v = r.getCardTerminals();
    while (v.hasMoreElements())
        CardTerminal c = (CardTerminal)v.nextElement();
        System.out.println("Card Name = " + c.getName());

The output is:

Card Name = Nitrokey Nitrokey HSM 0

Which matches with slot 0:

C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool.exe --list-slots
Available slots:
Slot 0 (0x0): Nitrokey Nitrokey HSM 0
token label : SmartCard-HSM (UserPIN)
token manufacturer :
token model : PKCS#15 emulated
token flags : login required, rng, token initialized, PIN initialized
hardware version : 24.13
firmware version : 3.3
serial num : DENK0102953
pin min/max : 6/15

It appears I have some configuration missing to tie the key store to the NitroHSM Key, as the code:

CardTerminal c = r.cardTerminalForName( “Nitrokey Nitrokey HSM 0” );

correctly returns the CardTerminal.

Thanks in advance for your help.