My code:
private GlobalPlatformService setupGPS(Card card) throws Exception {
CardChannel channel = card.getBasicChannel();
GlobalPlatformService service = new GlobalPlatformService(channel);
service.addAPDUListener(service);
service.openWithDefaultKeys();
return service;
}
InputStream is = ... [cap file stream]
GlobalPlatformService service = setupGPS(card);
CapFile cap = new CapFile(is, null);
int loadSize = GlobalPlatformService.defaultLoadSize - 8;
service.loadCapFile(cap, false, false, loadSize, false, false);
AID p = cap.getPackageAID();
for (AID a : cap.getAppletAIDs()) {
service.installAndMakeSelecatable(p, a,
null, INSTALL_PRIV, INSTALL_PARAMS, null);
}
This winds up throwing an NPE in loadCapFile - the line bo.write(sdAID.getLength());
There is a path through open() that doesn't set sdAID.
This worked in the previous release.
Reverting to version 14 of GlobalPlatformService fixed it.
This should be fixed in r17