use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class PINStepAction method performPACEWithCAN.
private EstablishChannelResponse performPACEWithCAN(Map<String, ExecutionResults> oldResults) {
DIDAuthenticationDataType paceInput = new DIDAuthenticationDataType();
paceInput.setProtocol(ECardConstants.Protocol.PACE);
AuthDataMap tmp;
try {
tmp = new AuthDataMap(paceInput);
} catch (ParserConfigurationException ex) {
LOG.error("Failed to read empty Protocol data.", ex);
return null;
}
AuthDataResponse paceInputMap = tmp.createResponse(paceInput);
if (capturePin) {
ExecutionResults executionResults = oldResults.get(getStepID());
PasswordField canField = (PasswordField) executionResults.getResult(PINStep.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);
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class RunGUI method pinInputStep.
private Step pinInputStep(Step requestedDataStep) throws Exception {
Step pinInputStep = new Step("PIN-Eingabe");
pinInputStep.setAction(new PinInputAction(pinInputStep, requestedDataStep));
Text t = new Text();
t.setText("Durch die Eingabe Ihrer PIN bestätigen Sie, dass folgende markierte Daten an den Anbieter übermittelt werden.");
pinInputStep.getInputInfoUnits().add(t);
Checkbox dataToSendSelection = new Checkbox("c1");
BoxItem vornameBoxItem = new BoxItem();
vornameBoxItem.setName("vornameBoxItem");
vornameBoxItem.setChecked(true);
vornameBoxItem.setDisabled(true);
vornameBoxItem.setText("Vorname");
BoxItem nameBoxItem = new BoxItem();
nameBoxItem.setName("nameBoxItem");
nameBoxItem.setChecked(true);
nameBoxItem.setDisabled(true);
nameBoxItem.setText("Name");
BoxItem doctordegreeBoxItem = new BoxItem();
doctordegreeBoxItem.setName("doctordegreeBoxItem");
doctordegreeBoxItem.setChecked(false);
doctordegreeBoxItem.setDisabled(true);
doctordegreeBoxItem.setText("Doktorgrad");
BoxItem addressBoxItem = new BoxItem();
addressBoxItem.setName("addressBoxItem");
addressBoxItem.setChecked(true);
addressBoxItem.setDisabled(true);
addressBoxItem.setText("Anschrift");
BoxItem birthdayBoxItem = new BoxItem();
birthdayBoxItem.setName("birthdayBoxItem");
birthdayBoxItem.setChecked(false);
birthdayBoxItem.setDisabled(true);
birthdayBoxItem.setText("Geburtstag");
BoxItem birthplaceBoxItem = new BoxItem();
birthplaceBoxItem.setName("birthplaceBoxItem");
birthplaceBoxItem.setChecked(false);
birthplaceBoxItem.setDisabled(true);
birthplaceBoxItem.setText("Geburtsort");
BoxItem pseudonymBoxItem = new BoxItem();
pseudonymBoxItem.setName("pseudonymBoxItem");
pseudonymBoxItem.setChecked(false);
pseudonymBoxItem.setDisabled(true);
pseudonymBoxItem.setText("Ordens-oder Künstlername");
BoxItem identiycardtypeBoxItem = new BoxItem();
identiycardtypeBoxItem.setName("identiycardtypeBoxItem");
identiycardtypeBoxItem.setChecked(false);
identiycardtypeBoxItem.setDisabled(true);
identiycardtypeBoxItem.setText("Ausweistyp");
BoxItem certificationcountryBoxItem = new BoxItem();
certificationcountryBoxItem.setName("certificationcountryBoxItem");
certificationcountryBoxItem.setChecked(false);
certificationcountryBoxItem.setDisabled(true);
certificationcountryBoxItem.setText("Ausstellendes Land");
BoxItem habitationBoxItem = new BoxItem();
habitationBoxItem.setName("habitationBoxItem");
habitationBoxItem.setChecked(false);
habitationBoxItem.setDisabled(true);
habitationBoxItem.setText("Wohnort");
BoxItem ageverificationBoxItem = new BoxItem();
ageverificationBoxItem.setName("ageverificationBoxItem");
ageverificationBoxItem.setChecked(false);
ageverificationBoxItem.setDisabled(true);
ageverificationBoxItem.setText("Altersverifikation");
Text sendAgreement_Text = new Text();
sendAgreement_Text.setText("Wenn Sie mit der Übermittlung der ausgewählten\n" + "Daten einverstanden sind, geben Sie bitte\n" + "Ihre 6-stellige PIN ein.");
PasswordField p1 = new PasswordField("pf1");
p1.setDescription("pass input1");
p1.setDescription("PIN:");
p1.setMaxLength(6);
dataToSendSelection.getBoxItems().add(vornameBoxItem);
dataToSendSelection.getBoxItems().add(nameBoxItem);
// dataToSendSelection.getBoxItems().add(doctordegreeBoxItem);
// dataToSendSelection.getBoxItems().add(addressBoxItem);
// dataToSendSelection.getBoxItems().add(birthdayBoxItem);
// dataToSendSelection.getBoxItems().add(birthplaceBoxItem);
// dataToSendSelection.getBoxItems().add(identiycardtypeBoxItem);
// dataToSendSelection.getBoxItems().add(certificationcountryBoxItem);
// dataToSendSelection.getBoxItems().add(habitationBoxItem);
// dataToSendSelection.getBoxItems().add(ageverificationBoxItem);
pinInputStep.getInputInfoUnits().add(dataToSendSelection);
// pinInputStep.getInputInfoUnits().add(sendAgreement_Text);
pinInputStep.getInputInfoUnits().add(p1);
return pinInputStep;
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class GenericPINAction method performPACEWithPIN.
private EstablishChannelResponse performPACEWithPIN(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 oldPINField = (PasswordField) executionResults.getResult(GenericPINStep.OLD_PIN_FIELD);
char[] oldPINValue = oldPINField.getValue();
if (oldPINValue.length > 6 && oldPINValue.length < 5) {
// let the user enter the can again, when input verification failed
return null;
} else {
paceInputMap.addElement(PACEInputType.PIN, new String(oldPINValue));
}
}
paceInputMap.addElement(PACEInputType.PIN_ID, PIN_ID_PIN);
// perform PACE by EstablishChannelCommand
EstablishChannel eChannel = createEstablishChannelStructure(paceInputMap);
return (EstablishChannelResponse) dispatcher.safeDeliver(eChannel);
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class GenericPINStep method createPINChangeGui.
private void createPINChangeGui() {
String pinChangeDescriptionText;
if (canSuccess) {
pinChangeDescriptionText = lang.translationForKey(PINSTEP_DESCRIPTION_AFTER_CAN, "PIN");
} else {
pinChangeDescriptionText = lang.translationForKey(PINSTEP_DESCRIPTION, "PIN");
}
Text pinChangeDescription = new Text(pinChangeDescriptionText);
getInputInfoUnits().add(pinChangeDescription);
Text dummy = new Text(" ");
getInputInfoUnits().add(dummy);
Text pinText = new Text(lang.translationForKey(PINSTEP_OLDPIN));
getInputInfoUnits().add(pinText);
PasswordField oldPIN = new PasswordField(OLD_PIN_FIELD);
// in case of transport pin
oldPIN.setMinLength(5);
oldPIN.setMaxLength(6);
getInputInfoUnits().add(oldPIN);
Text newPinText = new Text(lang.translationForKey(PINSTEP_NEWPIN));
getInputInfoUnits().add(newPinText);
PasswordField newPIN = new PasswordField(NEW_PIN_FIELD);
newPIN.setMaxLength(6);
newPIN.setMinLength(6);
getInputInfoUnits().add(newPIN);
Text newPinAgainText = new Text(lang.translationForKey(PINSTEP_NEWPINREPEAT));
getInputInfoUnits().add(newPinAgainText);
PasswordField newPINRepeat = new PasswordField(NEW_PIN_REPEAT_FIELD);
newPINRepeat.setMaxLength(6);
newPINRepeat.setMinLength(6);
getInputInfoUnits().add(newPINRepeat);
if (wrongPINFormat) {
// add note for mistyped PIN
Text noteWrongEntry = new Text();
noteWrongEntry.setText(lang.translationForKey(WRONG_ENTRY, "PIN"));
getInputInfoUnits().add(noteWrongEntry);
}
if (failedPINVerify) {
// add note for incorrect input
addVerifyFailed("PIN");
}
addRemainingAttempts();
}
use of org.openecard.gui.definition.PasswordField in project open-ecard by ecsec.
the class GenericPINStep method createCANGui.
private void createCANGui() {
Text i1 = new Text();
i1.setText(lang.translationForKey(CANSTEP_NOTICE));
getInputInfoUnits().add(i1);
Text i2 = new Text();
getInputInfoUnits().add(i2);
// add description and input fields depending on terminal type
i2.setText(lang.translationForKey(CANSTEP_DESCRIPTION));
PasswordField canField = new PasswordField(CAN_FIELD);
canField.setMinLength(6);
canField.setMaxLength(6);
canField.setDescription(lang.translationForKey(CANSTEP_CAN));
getInputInfoUnits().add(canField);
if (wrongCANFormat) {
// add note for mistyped CAN
Text retryText = new Text();
retryText.setText(lang.translationForKey(WRONG_CAN));
getInputInfoUnits().add(retryText);
}
if (failedCANVerify) {
// add note for incorrect input
addVerifyFailed("CAN");
}
}
Aggregations