use of org.openecard.sal.protocol.eac.gui.PINStep in project open-ecard by ecsec.
the class EacGuiImpl method getPinResult.
public List<OutputInfoUnit> getPinResult(Step step) throws InterruptedException {
if (step instanceof PINStep) {
PINStep pinStep = (PINStep) step;
switch(pinStep.getStatus()) {
case RC3:
this.pinStatus.deliver(PinStatus.RC3);
break;
case RC2:
this.pinStatus.deliver(PinStatus.RC2);
break;
case RC1:
this.pinStatus.deliver(PinStatus.CAN);
break;
}
// read values
String pinValue = this.userPin.deref();
String canValue = this.userCan.deref();
ArrayList<OutputInfoUnit> result = new ArrayList<>();
for (InputInfoUnit nextIn : pinStep.getInputInfoUnits()) {
if (pinValue != null && nextIn instanceof PasswordField && nextIn.getID().equals("PACE_PIN_FIELD")) {
PasswordField pw = new PasswordField(nextIn.getID());
pw.copyContentFrom(nextIn);
pw.setValue(pinValue.toCharArray());
result.add(pw);
} else if (canValue != null && nextIn instanceof PasswordField && nextIn.getID().equals("PACE_CAN_FIELD")) {
PasswordField pw = new PasswordField(nextIn.getID());
pw.copyContentFrom(nextIn);
pw.setValue(canValue.toCharArray());
result.add(pw);
}
}
return result;
} else {
throw new InterruptedException("The given step is not a PinStep.");
}
}
use of org.openecard.sal.protocol.eac.gui.PINStep in project open-ecard by ecsec.
the class EacGuiImplTest method createInitialSteps.
private List<Step> createInitialSteps() {
Step step1 = new Step("PROTOCOL_EAC_GUI_STEP_CVC", "CVC");
ToggleText sub = new ToggleText();
sub.setID("SubjectName");
sub.setText("Test Subject");
step1.getInputInfoUnits().add(sub);
final Step step2 = new Step("PROTOCOL_EAC_GUI_STEP_CHAT", "CHAT");
Checkbox readBox = new Checkbox("ReadCHATCheckBoxes");
readBox.getBoxItems().add(makeBoxItem("DG04", false, false));
readBox.getBoxItems().add(makeBoxItem("RESTRICTED_IDENTIFICATION", true, true));
step2.getInputInfoUnits().add(readBox);
step1.setAction(new StepAction(step1) {
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
return new StepActionResult(StepActionResultStatus.NEXT, step2);
}
});
final Step step3 = new PINStep(eacData, true, paceMarker, EacPinStatus.RC3);
step2.setAction(new StepAction(step2) {
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
return new StepActionResult(StepActionResultStatus.NEXT, step3);
}
});
final Step step4 = new Step("PROTOCOL_GUI_STEP_PROCESSING", "Finished");
return Arrays.asList(step1, step2, step3, step4);
}
Aggregations