Search in sources :

Example 16 with Transmit

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;
}
Also used : Transmit(iso.std.iso_iec._24727.tech.schema.Transmit) InputAPDUInfoType(iso.std.iso_iec._24727.tech.schema.InputAPDUInfoType)

Aggregations

Transmit (iso.std.iso_iec._24727.tech.schema.Transmit)12 TransmitResponse (iso.std.iso_iec._24727.tech.schema.TransmitResponse)10 InputAPDUInfoType (iso.std.iso_iec._24727.tech.schema.InputAPDUInfoType)9 Result (oasis.names.tc.dss._1_0.core.schema.Result)5 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)4 DIDAuthenticateResponse (iso.std.iso_iec._24727.tech.schema.DIDAuthenticateResponse)4 IOException (java.io.IOException)4 BigInteger (java.math.BigInteger)4 Connect (iso.std.iso_iec._24727.tech.schema.Connect)3 DIDAuthenticate (iso.std.iso_iec._24727.tech.schema.DIDAuthenticate)3 DIDAuthenticationDataType (iso.std.iso_iec._24727.tech.schema.DIDAuthenticationDataType)3 EstablishChannel (iso.std.iso_iec._24727.tech.schema.EstablishChannel)3 EstablishChannelResponse (iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse)3 CardResponseAPDU (org.openecard.common.apdu.common.CardResponseAPDU)3 BeginTransaction (iso.std.iso_iec._24727.tech.schema.BeginTransaction)2 BeginTransactionResponse (iso.std.iso_iec._24727.tech.schema.BeginTransactionResponse)2 CardApplicationConnect (iso.std.iso_iec._24727.tech.schema.CardApplicationConnect)2 CardApplicationConnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationConnectResponse)2 CardApplicationDisconnect (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect)2 CardApplicationDisconnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnectResponse)2