Lines Matching refs:apdu

72     private byte[] apdu;
80 // index of start of data within the apdu array
87 * <p>Note that the apdu bytes are copied to protect against
90 * @param apdu the complete command APDU
92 * @throws NullPointerException if apdu is null
93 * @throws IllegalArgumentException if apdu does not contain a valid
96 public CommandAPDU(byte[] apdu) {
97 this.apdu = apdu.clone();
107 * <p>Note that the apdu bytes are copied to protect against
110 * @param apdu the complete command APDU
111 * @param apduOffset the offset in the byte array at which the apdu
115 * @throws NullPointerException if apdu is null
117 * negative or if apduOffset + apduLength are greater than apdu.length,
120 public CommandAPDU(byte[] apdu, int apduOffset, int apduLength) {
121 checkArrayBounds(apdu, apduOffset, apduLength);
122 this.apdu = new byte[apduLength];
123 System.arraycopy(apdu, apduOffset, this.apdu, 0, apduLength);
155 * @param apdu the ByteBuffer containing the complete APDU
157 * @throws NullPointerException if apdu is null
158 * @throws IllegalArgumentException if apdu does not contain a valid
161 public CommandAPDU(ByteBuffer apdu) {
162 this.apdu = new byte[apdu.remaining()];
163 apdu.get(this.apdu);
291 if (apdu.length < 4) {
292 throw new IllegalArgumentException("apdu must be at least 4 bytes long");
294 if (apdu.length == 4) {
298 int l1 = apdu[4] & 0xff;
299 if (apdu.length == 5) {
305 if (apdu.length == 4 + 1 + l1) {
310 } else if (apdu.length == 4 + 2 + l1) {
314 int l2 = apdu[apdu.length - 1] & 0xff;
319 ("Invalid APDU: length=" + apdu.length + ", b1=" + l1);
322 if (apdu.length < 7) {
324 ("Invalid APDU: length=" + apdu.length + ", b1=" + l1);
326 int l2 = ((apdu[5] & 0xff) << 8) | (apdu[6] & 0xff);
327 if (apdu.length == 7) {
334 + apdu.length + ", b1=" + l1 + ", b2||b3=" + l2);
336 if (apdu.length == 4 + 3 + l2) {
341 } else if (apdu.length == 4 + 5 + l2) {
345 int leOfs = apdu.length - 2;
346 int l3 = ((apdu[leOfs] & 0xff) << 8) | (apdu[leOfs + 1] & 0xff);
350 + apdu.length + ", b1=" + l1 + ", b2||b3=" + l2);
398 this.apdu = new byte[4];
406 this.apdu = new byte[5];
408 this.apdu[4] = len;
420 this.apdu = new byte[7];
422 this.apdu[5] = l1;
423 this.apdu[6] = l2;
431 apdu = new byte[4 + 1 + dataLength];
433 apdu[4] = (byte)dataLength;
435 System.arraycopy(data, dataOffset, apdu, 5, dataLength);
438 apdu = new byte[4 + 3 + dataLength];
440 apdu[4] = 0;
441 apdu[5] = (byte)(dataLength >> 8);
442 apdu[6] = (byte)dataLength;
444 System.arraycopy(data, dataOffset, apdu, 7, dataLength);
450 apdu = new byte[4 + 2 + dataLength];
452 apdu[4] = (byte)dataLength;
454 System.arraycopy(data, dataOffset, apdu, 5, dataLength);
455 apdu[apdu.length - 1] = (ne != 256) ? (byte)ne : 0;
458 apdu = new byte[4 + 5 + dataLength];
460 apdu[4] = 0;
461 apdu[5] = (byte)(dataLength >> 8);
462 apdu[6] = (byte)dataLength;
464 System.arraycopy(data, dataOffset, apdu, 7, dataLength);
466 int leOfs = apdu.length - 2;
467 apdu[leOfs] = (byte)(ne >> 8);
468 apdu[leOfs + 1] = (byte)ne;
476 apdu[0] = (byte)cla;
477 apdu[1] = (byte)ins;
478 apdu[2] = (byte)p1;
479 apdu[3] = (byte)p2;
488 return apdu[0] & 0xff;
497 return apdu[1] & 0xff;
506 return apdu[2] & 0xff;
515 return apdu[3] & 0xff;
539 System.arraycopy(apdu, dataOffset, data, 0, nc);
559 return apdu.clone();
568 return "CommmandAPDU: " + apdu.length + " bytes, nc=" + nc + ", ne=" + ne;
587 return Arrays.equals(this.apdu, other.apdu);
596 return Arrays.hashCode(apdu);
601 apdu = (byte[])in.readUnshared();