Search in sources :

Example 1 with PasswordField

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

Example 2 with PasswordField

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

Example 3 with PasswordField

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

Example 4 with PasswordField

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

Example 5 with PasswordField

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

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