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;
}
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);
}
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);
}
Aggregations