Search in sources :

Example 16 with PasswordField

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);
}
Also used : EstablishChannel(iso.std.iso_iec._24727.tech.schema.EstablishChannel) AuthDataMap(org.openecard.common.anytype.AuthDataMap) ExecutionResults(org.openecard.gui.executor.ExecutionResults) EstablishChannelResponse(iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse) DIDAuthenticationDataType(iso.std.iso_iec._24727.tech.schema.DIDAuthenticationDataType) AuthDataResponse(org.openecard.common.anytype.AuthDataResponse) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) PasswordField(org.openecard.gui.definition.PasswordField)

Example 17 with PasswordField

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;
}
Also used : Checkbox(org.openecard.gui.definition.Checkbox) ToggleText(org.openecard.gui.definition.ToggleText) Text(org.openecard.gui.definition.Text) Step(org.openecard.gui.definition.Step) PasswordField(org.openecard.gui.definition.PasswordField) BoxItem(org.openecard.gui.definition.BoxItem)

Example 18 with PasswordField

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);
}
Also used : EstablishChannel(iso.std.iso_iec._24727.tech.schema.EstablishChannel) AuthDataMap(org.openecard.common.anytype.AuthDataMap) ExecutionResults(org.openecard.gui.executor.ExecutionResults) EstablishChannelResponse(iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse) DIDAuthenticationDataType(iso.std.iso_iec._24727.tech.schema.DIDAuthenticationDataType) AuthDataResponse(org.openecard.common.anytype.AuthDataResponse) PasswordField(org.openecard.gui.definition.PasswordField)

Example 19 with PasswordField

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();
}
Also used : Text(org.openecard.gui.definition.Text) PasswordField(org.openecard.gui.definition.PasswordField)

Example 20 with PasswordField

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");
    }
}
Also used : Text(org.openecard.gui.definition.Text) PasswordField(org.openecard.gui.definition.PasswordField)

Aggregations

PasswordField (org.openecard.gui.definition.PasswordField)22 Text (org.openecard.gui.definition.Text)10 ExecutionResults (org.openecard.gui.executor.ExecutionResults)7 EstablishChannelResponse (iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse)6 DIDAuthenticationDataType (iso.std.iso_iec._24727.tech.schema.DIDAuthenticationDataType)5 EstablishChannel (iso.std.iso_iec._24727.tech.schema.EstablishChannel)5 AuthDataMap (org.openecard.common.anytype.AuthDataMap)5 AuthDataResponse (org.openecard.common.anytype.AuthDataResponse)5 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)3 Step (org.openecard.gui.definition.Step)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 InputInfoUnit (org.openecard.gui.definition.InputInfoUnit)2 CardApplicationDisconnect (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect)1 ControlIFDResponse (iso.std.iso_iec._24727.tech.schema.ControlIFDResponse)1 DestroyChannel (iso.std.iso_iec._24727.tech.schema.DestroyChannel)1 Disconnect (iso.std.iso_iec._24727.tech.schema.Disconnect)1 PasswordAttributesType (iso.std.iso_iec._24727.tech.schema.PasswordAttributesType)1 ArrayList (java.util.ArrayList)1 WSHelper (org.openecard.common.WSHelper)1 APDUException (org.openecard.common.apdu.exception.APDUException)1