use of iso.std.iso_iec._24727.tech.schema.CardInfoType in project open-ecard by ecsec.
the class MiddlewareSAL method getCardInfo.
@Override
public CardInfoType getCardInfo(@Nonnull ConnectionHandleType handle, @Nonnull String cardType) throws RuntimeException {
CardInfoType cif = mwSALConfig.getCardInfo(cardType);
CardSpecType cardSpec = mwSALConfig.getCardSpecType(cardType);
if (cif != null) {
cif = augmentCardInfo(handle, cif, cardSpec);
return cif;
} else {
LOG.error("No CIF available for card type '" + cardType + '"');
return null;
}
}
use of iso.std.iso_iec._24727.tech.schema.CardInfoType in project open-ecard by ecsec.
the class MwStateCallback method addEntry.
public boolean addEntry(MwEventObject o) {
try {
ConnectionHandleType handle = o.getHandle();
MwSlot slot = o.getMwSlot();
MwToken token = slot.getTokenInfo();
String cardType = null;
String type = String.format("%s_%s", token.getManufacturerID(), token.getModel());
for (MiddlewareConfig mwConfig : mwConfigs) {
cardType = mwConfig.mapMiddlewareType(type);
if (cardType != null) {
break;
}
}
CardInfoType cif = null;
if (cardType != null) {
cif = env.getCIFProvider().getCardInfo(handle, cardType);
}
if (cif == null) {
LOG.warn("Unknown card recognized by Middleware.");
return false;
}
// create new entry in card states
CardStateEntry entry = new CardStateEntry(handle, cif, null);
states.addEntry(entry);
return true;
} catch (CryptokiException ex) {
LOG.info("Cryptoki Token invalid.", ex);
} catch (RuntimeException ex) {
LOG.error("Error in CIF augmentation process.", ex);
}
return false;
}
use of iso.std.iso_iec._24727.tech.schema.CardInfoType in project open-ecard by ecsec.
the class CIFCreator method addTokenInfo.
public CardInfoType addTokenInfo() throws WSMarshallerException, CryptokiException {
LOG.debug("Adding information to CardInfo file for card type {}.", cif.getCardType().getObjectIdentifier());
PIN_NAME = "USER_PIN";
DIDInfoType pinDid = createPinDID();
List<DIDInfoType> cryptoDids = getSignatureCryptoDIDs();
List<DataSetInfoType> datasets = getCertificateDatasets();
CardApplicationType app = cif.getApplicationCapabilities().getCardApplication().get(0);
app.getDIDInfo().add(pinDid);
app.getDIDInfo().addAll(cryptoDids);
app.getDataSetInfo().addAll(datasets);
return cif;
}
use of iso.std.iso_iec._24727.tech.schema.CardInfoType in project open-ecard by ecsec.
the class CardRecognitionImpl method getTranslatedCardName.
/**
* Gets the translated card name for a card type.
*
* @param cardType The card type to get the card name for.
* @return A card name matching the users locale or the English name as default. If the card is not supported, the
* string {@code Unknown card type} is returned.
*/
@Override
public String getTranslatedCardName(String cardType) {
CardInfoType info = getCardInfo(cardType);
Locale userLocale = Locale.getDefault();
String langCode = userLocale.getLanguage();
String enFallback = "Unknown card type.";
if (info == null) {
// we can identify the card but do not have a card info file for it
return enFallback;
}
for (InternationalStringType typ : info.getCardType().getCardTypeName()) {
if (typ.getLang().equalsIgnoreCase("en")) {
enFallback = typ.getValue();
}
if (typ.getLang().equalsIgnoreCase(langCode)) {
return typ.getValue();
}
}
return enFallback;
}
use of iso.std.iso_iec._24727.tech.schema.CardInfoType in project open-ecard by ecsec.
the class CardRecognitionImpl method getCardInfoFromRepo.
@Override
public CardInfoType getCardInfoFromRepo(String type) {
CardInfoType cif = null;
// only do something when a repo is specified
if (cif == null && cifRepo != null) {
GetCardInfoOrACD req = new GetCardInfoOrACD();
req.setAction(ECardConstants.CIF.GET_SPECIFIED);
req.getCardTypeIdentifier().add(type);
GetCardInfoOrACDResponse res = getCifRepo().getCardInfoOrACD(req);
// checkout response if it contains our cardinfo
List<Serializable> cifs = res.getCardInfoOrCapabilityInfo();
for (Serializable next : cifs) {
if (next instanceof CardInfoType) {
return (CardInfoType) next;
}
}
}
return cif;
}
Aggregations