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


Java CommandAPDU.getNe方法代码示例

本文整理汇总了Java中javax.smartcardio.CommandAPDU.getNe方法的典型用法代码示例。如果您正苦于以下问题:Java CommandAPDU.getNe方法的具体用法?Java CommandAPDU.getNe怎么用?Java CommandAPDU.getNe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.smartcardio.CommandAPDU的用法示例。


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

示例1: formatCommandAPDU

import javax.smartcardio.CommandAPDU; //导入方法依赖的package包/类
/**
 * Create a human friendly representation of a @CommandAPDU.
 */
public static String formatCommandAPDU(CommandAPDU command) {
  if (command.getNc() > 0) {
    if (command.getNe() > 0) {
      return format("[Sent] %02X %02X %02X %02X Lc = %02X Le = %02X ", command.getCLA(),
                    command.getINS(), command.getP1(), command.getP2(), command.getNc(),
                    command.getNe())
             + HexString.bytesToHex(command.getData());
    } else {
      return format("[Sent] %02X %02X %02X %02X %02X  ", command.getCLA(),
                    command.getINS(), command.getP1(), command.getP2(), command.getNc())
             + HexString.bytesToHex(command.getData());
    }
  } else {
    return format("[Sent] %02X %02X %02X %02X %02X  ", command.getCLA(),
                  command.getINS(), command.getP1(), command.getP2(), command.getNe());
  }
}
 
开发者ID:FluffyKaon,项目名称:OpenPGP-Card,代码行数:21,代码来源:CardUtils.java

示例2: setUpClass

import javax.smartcardio.CommandAPDU; //导入方法依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
    //expected values of apdu, data, headers, nc, ne
    CommandAPDU capdu = new CommandAPDU(C1);
    apdu = capdu.getBytes();
    data = capdu.getData();

    cla = capdu.getCLA();
    if (cla != (C1[0] & 0xff)) {
        throw new RuntimeException("Failure: cla is not right");
    }

    ins = capdu.getINS();
    if (ins != (C1[1] & 0xff)) {
        throw new RuntimeException("Failure: ins is not right");
    }

    p1 = capdu.getP1();
    if (p1 != (C1[2] & 0xff)) {
        throw new RuntimeException("Failure: p1 is not right");
    }

    p2 = capdu.getP2();
    if (p2 != (C1[3] & 0xff)) {
        throw new RuntimeException("Failure: p2 is not right");
    }

    nc = capdu.getNc();
    ne = capdu.getNe();

    //Test on following constructors
    cm1 = new CommandAPDU(apdu);
    cm2 = new CommandAPDU(cla, ins, p1, p2);
    cm3 = new CommandAPDU(cla, ins, p1, p2, data);
    cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne);
    cm5 = new CommandAPDU(cla, ins, p1, p2, ne);
    cm6 = new CommandAPDU(ByteBuffer.wrap(apdu));
    cm7 = new CommandAPDU(apdu, 0, apdu.length);
    cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc);
    cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:42,代码来源:CommandAPDUTest.java


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