当前位置: 首页>>代码示例>>Java>>正文


Java AID类代码示例

本文整理汇总了Java中sasc.iso7816.AID的典型用法代码示例。如果您正苦于以下问题:Java AID类的具体用法?Java AID怎么用?Java AID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AID类属于sasc.iso7816包,在下文中一共展示了AID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAID

import sasc.iso7816.AID; //导入依赖的package包/类
public void addAID(AID aid){
    allAIDs.add(aid);
    
    KnownAIDList.KnownAID knownAID = KnownAIDList.searchAID(aid.getAIDBytes());
    if(knownAID != null){
        String type = knownAID.getType();
        if("EMV".equalsIgnoreCase(type)){
            EMVApplication emvApp = new EMVApplication();
            emvApp.setAID(aid);
            emvApp.setCard(this);
            addEMVApplication(emvApp);
        }else if("GP".equalsIgnoreCase(type)){
            //TODO
        }
    } else {
        //TODO unhandled AIDs list
    }
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:19,代码来源:SmartCard.java

示例2: processSelect

import sasc.iso7816.AID; //导入依赖的package包/类
private byte[] processSelect(byte[] cmd) {
    if (Arrays.equals(cmd, SELECT_MASTER_FILE)) {
        if (card.masterFile != null) {
            return createResponse(card.masterFile, SW.SUCCESS);
        } else {
            return createResponse(null, SW.INSTRUCTION_CODE_NOT_SUPPORTED_OR_INVALID);
        }
    }
    if (cmd.length <= 5){ //Zero length AID
        return createResponse(null, SW.FILE_OR_APPLICATION_NOT_FOUND);
    }
    if (Arrays.equals(cmd, SELECT_DDF_PSE)) {
        return createResponse(card.ddf, SW.SUCCESS);
    }
    //Assume SELECT APPLICATION
    AID aid = new AID(getDataBytes(cmd));
    if (card.applicationsMap.containsKey(aid)) {
        card.selectedApp = card.applicationsMap.get(aid);
        return createResponse(card.selectedApp.adf, SW.SUCCESS);
    } else {
        return createResponse(null, SW.COMMAND_NOT_ALLOWED_CONDITIONS_OF_USE_NOT_SATISFIED); //TODO check what SW to return
    }
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:24,代码来源:CardEmulator.java

示例3: main

import sasc.iso7816.AID; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    AID aid = new AID("A0 00 00 01 67 41 30 00 FF");
    JCOPApplication jcopApp = new JCOPApplication(aid, Util.fromHexString("B3 11 01 29 00 00 00 00 50 48 36 35 30 41 01 03 C1 3C 82"), null);
    System.out.println(jcopApp);
    
    CardConnection cardConnection = TerminalUtil.connect(TerminalUtil.State.CARD_INSERTED); //Waits for card insertion
    Log.info(Util.prettyPrintHexNoWrap(cardConnection.getATR()));
    Log.info(ATR_DB.searchATR(cardConnection.getATR()).toString());
    
    CardResponse selectJcopResponse = cardConnection.transmit(Util.fromHexString("00 a4 04 00 09 a0 00 00 01 67 41 30 00 ff 00"));
    System.out.println(selectJcopResponse);
    System.out.println(new JCOPApplication(aid, selectJcopResponse.getData(), null));

}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:15,代码来源:JCOPApplication.java

示例4: main

import sasc.iso7816.AID; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    CardConnection cardConnection = TerminalUtil.connect(TerminalUtil.State.CARD_INSERTED); //Waits for card present
    Log.info(Util.prettyPrintHexNoWrap(cardConnection.getATR()));
    Log.info(ATR_DB.searchATR(cardConnection.getATR()).toString());
    GlobalPlatformDriver gpd = new GlobalPlatformDriver();
    gpd.process(new AID(GPSD_AID), null, cardConnection);
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:8,代码来源:GlobalPlatformDriver.java

示例5: KnownAID

import sasc.iso7816.AID; //导入依赖的package包/类
KnownAID(String name, AID aid, String type, boolean supported, ApplicationSelectionIndicator asi, String description) {
    this.name = name;
    this.aid = aid;
    this.type = type;
    this.supported = supported;
    this.asi = asi;
    this.description = description;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:9,代码来源:KnownAIDList.java

示例6: _initFromFile

import sasc.iso7816.AID; //导入依赖的package包/类
private static void _initFromFile(String filename) {
    try {
        XMLElement aidListElement = new XMLElement();
        aidListElement.parseFromReader(new InputStreamReader(Util.loadResource(KnownAIDList.class, filename), "UTF-8"));

        if (!"AIDList".equalsIgnoreCase(aidListElement.getName())) {
            throw new RuntimeException("Unexpected Root Element: <" + aidListElement.getName() + "> . Expected <AIDList>");
        }
        for (Object aidListChildObject : aidListElement.getChildren()) {
            XMLElement appElement = (XMLElement) aidListChildObject;
            String appElementName = appElement.getName();

            if (!"Application".equalsIgnoreCase(appElementName)) {
                throw new RuntimeException("Unexpected XML Element: <" + appElementName + "> . Expected <Application>");
            }
            String aidStr = appElement.getStringAttribute("AID");
            AID aid = new AID(aidStr);
            boolean supported = appElement.getBooleanAttribute("Supported", "true", "false", false);
            String asiStr = appElement.getStringAttribute("ASI");
            String type = appElement.getStringAttribute("Type");
            String name = appElement.getStringAttribute("Name");
            String description = appElement.getStringAttribute("Description");
            knownAIDsMap.put(aid, new KnownAID(name, aid, type, supported, ApplicationSelectionIndicator.valueOf(asiStr), description));
        }
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }

}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:30,代码来源:KnownAIDList.java

示例7: parseApplicationsElement

import sasc.iso7816.AID; //导入依赖的package包/类
private Map<AID, Application> parseApplicationsElement(XMLElement applicationsElement) {
    Map<AID, Application> map = new LinkedHashMap<AID, Application>();
    for (Object appObject : applicationsElement.getChildren()) {
        XMLElement appElement = (XMLElement) appObject;
        String appElementName = appElement.getName();
        if ("Application".equalsIgnoreCase(appElementName)) {
            Application app = new Application();
            AID aid = new AID(appElement.getStringAttribute("AID"));
            app.aid = aid;
            map.put(aid, app);
            for (Object appChildObject : appElement.getChildren()) {
                XMLElement appChildElement = (XMLElement) appChildObject;
                String appChildElementName = appChildElement.getName();
                if ("PIN".equalsIgnoreCase(appChildElementName)) {
                    app.pin = Integer.parseInt(appChildElement.getContent().trim());
                } else if ("ApplicationDefinitionFile".equalsIgnoreCase(appChildElementName)) {
                    app.adf = Util.fromHexString(Util.removeCRLFTab(appChildElement.getContent().trim()));
                } else if ("GetDataElements".equalsIgnoreCase(appChildElementName)) {
                    parseGetDataElement(appChildElement, app);
                } else if ("GetProcessingOptions".equalsIgnoreCase(appChildElementName)) {
                    app.getProcessingOpts = Util.fromHexString(Util.removeCRLFTab(appChildElement.getContent().trim()));
                } else if ("Files".equalsIgnoreCase(appChildElementName)) {
                    app.filesMap = parseFilesElement(appChildElement);
                } else {
                    throw new RuntimeException("Unexpected XML Element: <" + appChildElementName + "> : " + appChildElement);
                }
            }
        } else {
            throw new RuntimeException("Unexpected XML Element: <" + appElementName + "> : " + appElement);
        }
    }
    return map;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:34,代码来源:CardEmulator.java

示例8: getWalletDisplayString

import sasc.iso7816.AID; //导入依赖的package包/类
private String getWalletDisplayString(WalletControllerFCI wcFci, AID mmAid) {
	StringBuilder buff = new StringBuilder();
	buff.append("Wallet applets: ");
	buff.append("\n\n");
	buff.append(wcFci == null ? "Wallet controller: not installed" : wcFci
			.toString());
	buff.append("\n\n");
	buff.append("MIFARE manager applet");
	buff.append("\n");
	buff.append(mmAid == null ? "Mifare manager: not installed" : mmAid
			.toString());

	return buff.toString();
}
 
开发者ID:gsbabil,项目名称:ClassicNFC,代码行数:15,代码来源:MainActivity.java

示例9: parse

import sasc.iso7816.AID; //导入依赖的package包/类
public static WalletControllerFCI parse(byte[] raw) {
    WalletControllerFCI result = new WalletControllerFCI();

    BERTLV tlv = EMVUtil.getNextTLV(new ByteArrayInputStream(raw));
    if (tlv.getTag().equals(EMVTags.FCI_TEMPLATE)) {
        ByteArrayInputStream templateStream = tlv.getValueStream();
        while (templateStream.available() >= 2) {
            tlv = EMVUtil.getNextTLV(templateStream);
            if (tlv.getTag().equals(EMVTags.DEDICATED_FILE_NAME)) {
                result.aid = new AID(tlv.getValueBytes());
            } else if (tlv.getTag()
                    .equals(EMVTags.FCI_PROPRIETARY_TEMPLATE)) {
                ByteArrayInputStream fciBis = new ByteArrayInputStream(
                        tlv.getValueBytes());
                int totalLen = fciBis.available();
                int templateLen = tlv.getLength();
                while (fciBis.available() > (totalLen - templateLen)) {
                    tlv = EMVUtil.getNextTLV(fciBis);
                    if (tlv.getTag().equals(
                            EMVTags.RESPONSE_MESSAGE_TEMPLATE_1)) {
                        int len = tlv.getValueBytes().length;
                        result.version = Util.byte2Short(
                                tlv.getValueBytes()[len - 2],
                                tlv.getValueBytes()[len - 1]);
                    }
                }
            }
        }
    } else {
        throw new IllegalArgumentException("Invalid Wallet FCI response");
    }

    return result;
}
 
开发者ID:gsbabil,项目名称:ClassicNFC,代码行数:35,代码来源:WalletControllerFCI.java

示例10: getAID

import sasc.iso7816.AID; //导入依赖的package包/类
@Override
public AID getAID() {
    return aid;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:5,代码来源:JCOPApplication.java

示例11: getSecurityManagerAid

import sasc.iso7816.AID; //导入依赖的package包/类
public AID getSecurityManagerAid() {
    return securityManagerAid;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:4,代码来源:SecurityDomainFCI.java

示例12: ISDApplication

import sasc.iso7816.AID; //导入依赖的package包/类
public ISDApplication(AID aid, SmartCard card) {
    this.aid = aid;
    this.card = card;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:5,代码来源:ISDApplication.java

示例13: NDEFApplication

import sasc.iso7816.AID; //导入依赖的package包/类
public NDEFApplication(AID aid, SmartCard card) {
    this.aid = aid;
    this.card = card;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:5,代码来源:NDEFApplication.java

示例14: getAllAIDs

import sasc.iso7816.AID; //导入依赖的package包/类
public Set<AID> getAllAIDs(){
    return Collections.unmodifiableSet(allAIDs);
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:4,代码来源:SmartCard.java

示例15: registerAidHandler

import sasc.iso7816.AID; //导入依赖的package包/类
public void registerAidHandler(ApplicationHandler aidHandler, AID aid) {
    registerAidHandler(aidHandler, Util.byteArrayToHexString(aid.getAIDBytes()));
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:4,代码来源:Registry.java


注:本文中的sasc.iso7816.AID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。