Search in sources :

Example 1 with PCSCPinVerify

use of org.openecard.ifd.scio.reader.PCSCPinVerify in project open-ecard by ecsec.

the class NativePinStepAction method nativePinVerify.

private byte[] nativePinVerify() throws IFDException, SCIOException {
    // get data for verify command and perform it
    PCSCPinVerify verifyStruct = new PCSCPinVerify(pinInput.getPasswordAttributes(), template);
    byte[] verifyStructData = verifyStruct.toBytes();
    // only called when this terminal has the capability
    Map<Integer, Integer> features = termInfo.getFeatureCodes();
    byte[] result = ch.transmitControlCommand(features.get(PCSCFeatures.VERIFY_PIN_DIRECT), verifyStructData);
    return result;
}
Also used : PCSCPinVerify(org.openecard.ifd.scio.reader.PCSCPinVerify)

Example 2 with PCSCPinVerify

use of org.openecard.ifd.scio.reader.PCSCPinVerify in project open-ecard by ecsec.

the class PINTest method verifyISO.

@Test
public void verifyISO() throws IFDException {
    PasswordAttributesType pwdAttr = create(true, ISO_9564_1, 4, 8);
    PCSCPinVerify ctrlStruct = new PCSCPinVerify(pwdAttr, StringUtils.toByteArray("00200001"));
    ctrlStruct.setLang(Locale.GERMANY);
    byte[] structData = ctrlStruct.toBytes();
    // length=13
    String pinStr = "00 20 00 01 08 20 FF FF FF FF FF FF FF";
    String ctrlStr = "3C 00 89 47 04 0E04 02 01 0704 00 000000 0D000000";
    byte[] referenceData = StringUtils.toByteArray(ctrlStr + pinStr, true);
    assertEquals(referenceData, structData);
}
Also used : PasswordAttributesType(iso.std.iso_iec._24727.tech.schema.PasswordAttributesType) PCSCPinVerify(org.openecard.ifd.scio.reader.PCSCPinVerify) Test(org.testng.annotations.Test)

Example 3 with PCSCPinVerify

use of org.openecard.ifd.scio.reader.PCSCPinVerify in project open-ecard by ecsec.

the class PINTest method verifyASCII.

@Test
public void verifyASCII() throws IFDException {
    PasswordAttributesType pwdAttr = create(false, ASCII_NUMERIC, 4, 4);
    PCSCPinVerify ctrlStruct = new PCSCPinVerify(pwdAttr, StringUtils.toByteArray("00200001"));
    ctrlStruct.setLang(Locale.GERMANY);
    byte[] structData = ctrlStruct.toBytes();
    // length=5
    String pinStr = "00 20 00 01";
    String ctrlStr = "3C 00 82 04 00 0404 02 01 0704 00 000000 04000000";
    byte[] referenceData = StringUtils.toByteArray(ctrlStr + pinStr, true);
    assertEquals(referenceData, structData);
}
Also used : PasswordAttributesType(iso.std.iso_iec._24727.tech.schema.PasswordAttributesType) PCSCPinVerify(org.openecard.ifd.scio.reader.PCSCPinVerify) Test(org.testng.annotations.Test)

Aggregations

PCSCPinVerify (org.openecard.ifd.scio.reader.PCSCPinVerify)3 PasswordAttributesType (iso.std.iso_iec._24727.tech.schema.PasswordAttributesType)2 Test (org.testng.annotations.Test)2