public synchronized void refresh() throws P11TokenException { LOG.info("refreshing PKCS#11 module {}", module.getName()); List<P11SlotIdentifier> slotIds = module.getSlotIds(); for (P11SlotIdentifier slotId : slotIds) { P11Slot slot; try { slot = module.getSlot(slotId); } catch (P11TokenException ex) { LogUtil.warn(LOG, ex, "P11TokenException while initializing slot " + slotId); continue; } catch (Throwable th) { LOG.error("unexpected error while initializing slot " + slotId, th); continue; } slot.refresh(); } LOG.info("refreshed PKCS#11 module {}", module.getName()); } // method refresh
public synchronized void refresh() throws P11TokenException { LOG.info("refreshing PKCS#11 module {}", module.getName()); List<P11SlotIdentifier> slotIds = module.getSlotIds(); for (P11SlotIdentifier slotId : slotIds) { P11Slot slot; try { slot = module.getSlot(slotId); } catch (P11TokenException ex) { LogUtil.warn(LOG, ex, "P11TokenException while initializing slot " + slotId); continue; } catch (Throwable th) { LOG.error("unexpected error while initializing slot " + slotId, th); continue; } slot.refresh(); } LOG.info("refreshed PKCS#11 module {}", module.getName()); } // method refresh
private void engineLoad(String moduleName) throws P11TokenException, XiSecurityException { P11CryptService p11Service = p11CryptServiceFactory.getP11CryptService(moduleName); P11Module module = p11Service.getModule(); List<P11SlotIdentifier> slotIds = module.getSlotIds(); for (P11SlotIdentifier slotId: slotIds) { P11Slot slot = module.getSlot(slotId); Set<P11ObjectIdentifier> identityIds = slot.getIdentityKeyIds(); for (P11ObjectIdentifier objId : identityIds) { P11Identity identity = slot.getIdentity(objId); X509Certificate[] chain = identity.certificateChain(); if (chain == null || chain.length == 0) { continue; } P11PrivateKey key = new P11PrivateKey(p11Service, identity.getId()); KeyCertEntry keyCertEntry = new KeyCertEntry(key, chain); keyCerts.put(moduleName + "#slotid-" + slotId.getId() + "#keyid-" + objId.getIdHex(), keyCertEntry); keyCerts.put(moduleName + "#slotid-" + slotId.getId() + "#keylabel-" + objId.getLabel(), keyCertEntry); keyCerts.put(moduleName + "#slotindex-" + slotId.getIndex() + "#keyid-" + objId.getIdHex(), keyCertEntry); keyCerts.put(moduleName + "#slotindex-" + slotId.getIndex() + "#keylabel-" + objId.getLabel(), keyCertEntry); } } } // method engineLoad
private void engineLoad(String moduleName) throws P11TokenException, XiSecurityException { P11CryptService p11Service = p11CryptServiceFactory.getP11CryptService(moduleName); P11Module module = p11Service.getModule(); List<P11SlotIdentifier> slotIds = module.getSlotIds(); for (P11SlotIdentifier slotId: slotIds) { P11Slot slot = module.getSlot(slotId); Set<P11ObjectIdentifier> identityIds = slot.getIdentityKeyIds(); for (P11ObjectIdentifier objId : identityIds) { P11Identity identity = slot.getIdentity(objId); X509Certificate[] chain = identity.certificateChain(); if (chain == null || chain.length == 0) { continue; } P11PrivateKey key = new P11PrivateKey(p11Service, identity.getId()); KeyCertEntry keyCertEntry = new KeyCertEntry(key, chain); keyCerts.put(moduleName + "#slotid-" + slotId.getId() + "#keyid-" + objId.getIdHex(), keyCertEntry); keyCerts.put(moduleName + "#slotid-" + slotId.getId() + "#keylabel-" + objId.getLabel(), keyCertEntry); keyCerts.put(moduleName + "#slotindex-" + slotId.getIndex() + "#keyid-" + objId.getIdHex(), keyCertEntry); keyCerts.put(moduleName + "#slotindex-" + slotId.getIndex() + "#keylabel-" + objId.getLabel(), keyCertEntry); } } } // method engineLoad