use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class AbstractTerminal method pinUserConsent.
private UserConsentDescription pinUserConsent(String title, int minLength, int maxLength) {
UserConsentDescription uc = new UserConsentDescription(LANG.translationForKey(title), "pin_entry_dialog");
// create step
Step s = new Step("enter-pin", LANG.translationForKey("action.changepin.userconsent.pinstep.title"));
uc.getSteps().add(s);
// add text instructing user
// add text instructing user
Text i1 = new Text();
s.getInputInfoUnits().add(i1);
i1.setText(LANG.translationForKey("action.pinentry.userconsent.pinstep.enter_pin"));
PasswordField i2 = new PasswordField("pin");
s.getInputInfoUnits().add(i2);
i2.setDescription("PIN");
i2.setMinLength(minLength);
i2.setMaxLength(maxLength);
return uc;
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class PinChangeStepAction method getNewPin.
private char[] getNewPin() throws PinsDoNotMatchException {
char[] pin1 = null;
char[] pin2 = null;
for (InputInfoUnit info : pinStep.getInputInfoUnits()) {
if (PinChangeStep.NEW_PIN_FIELD1.equals(info.getID())) {
pin1 = ((PasswordField) info).getValue();
} else if (PinChangeStep.NEW_PIN_FIELD2.equals(info.getID())) {
pin2 = ((PasswordField) info).getValue();
}
}
if (pin1 != null && Arrays.equals(pin1, pin2)) {
return pin1;
} else {
throw new PinsDoNotMatchException("The PINs entered in the UI do not match.");
}
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class PINStep method processResult.
/**
* Processes the results of step.
*
* @param results Results
*/
public void processResult(Map<String, ExecutionResults> results) {
ExecutionResults executionResults = results.get(step.getID());
if (executionResults == null) {
return;
}
PasswordField p = (PasswordField) executionResults.getResult(passwordType);
content.add(GUIContentMap.ELEMENT.PIN, p.getValue());
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class CANStepAction method verifyUserInput.
/**
* Verify the input of the user (e.g. no empty mandatory fields, pin length, allowed charset).
*
* @param executionResults The results containing the OutputInfoUnits of interest.
* @return True if the input of the user could be verified, else false.
*/
private boolean verifyUserInput(ExecutionResults executionResults) {
// TODO: check pin length and possibly allowed charset with CardInfo file
PasswordField canField = (PasswordField) executionResults.getResult(CANEntryStep.CAN_FIELD);
can = new String(canField.getValue());
if (can.isEmpty() || can.length() != 6) {
return false;
}
return true;
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class GenericPINAction method performPACEWithCAN.
private EstablishChannelResponse performPACEWithCAN(Map<String, ExecutionResults> oldResults) throws ParserConfigurationException {
DIDAuthenticationDataType paceInput = new DIDAuthenticationDataType();
paceInput.setProtocol(ECardConstants.Protocol.PACE);
AuthDataMap tmp = new AuthDataMap(paceInput);
AuthDataResponse paceInputMap = tmp.createResponse(paceInput);
if (capturePin) {
ExecutionResults executionResults = oldResults.get(getStepID());
PasswordField canField = (PasswordField) executionResults.getResult(GenericPINStep.CAN_FIELD);
String canValue = new String(canField.getValue());
if (canValue.length() != 6) {
// let the user enter the can again, when input verification failed
return null;
} else {
paceInputMap.addElement(PACEInputType.PIN, canValue);
}
}
paceInputMap.addElement(PACEInputType.PIN_ID, PIN_ID_CAN);
// perform PACE by EstablishChannelCommand
EstablishChannel eChannel = createEstablishChannelStructure(paceInputMap);
return (EstablishChannelResponse) dispatcher.safeDeliver(eChannel);
}
Aggregations