use of iso.std.iso_iec._24727.tech.schema.Transmit in project open-ecard by ecsec.
the class PINUtils method buildVerifyTransmit.
/**
* Build a Transmit containing a verify APDU.
*
* @param rawPIN the pin as entered by the user
* @param attributes attributes of the password (e.g. encoding and length)
* @param template the verify template
* @param slotHandle slot handle
* @return Transmit containing the built verify APDU
* @throws UtilException if an pin related error occurs (e.g. wrong PIN length)
*/
public static Transmit buildVerifyTransmit(char[] rawPIN, PasswordAttributesType attributes, byte[] template, byte[] slotHandle) throws UtilException {
// concatenate template with encoded pin
byte[] pin = PINUtils.encodePin(rawPIN, attributes);
byte[] pinCmd = ByteUtils.concatenate(template, (byte) pin.length);
pinCmd = ByteUtils.concatenate(pinCmd, pin);
Arrays.fill(pin, (byte) 0);
Transmit transmit = new Transmit();
transmit.setSlotHandle(slotHandle);
InputAPDUInfoType pinApdu = new InputAPDUInfoType();
pinApdu.setInputAPDU(pinCmd);
pinApdu.getAcceptableStatusCode().add(new byte[] { (byte) 0x90, (byte) 0x00 });
transmit.getInputAPDUInfo().add(pinApdu);
return transmit;
}
Aggregations