Qt Cryptographic Architecture: QCA::ConsolePrompt Class Reference

Qt Cryptographic Architecture

Signals | Public Member Functions | Friends | List of all members
QCA::ConsolePrompt Class Reference
QCA user API

`#include <QtCrypto>`

Collaboration diagram for QCA::ConsolePrompt:
[legend]

## Signals
void | finished ()

## Public Member Functions
| ConsolePrompt (QObject *parent=0)
void | getChar ()
void | getHidden (const QString &promptStr)
SecureArray | result () const
QChar | resultChar () const
void | waitForFinished ()

## Friends
class | Private

## Detailed Description

Console prompt handler.

This class provides a convenient way to get user input in a secure way, as shown below:

QCA::ConsolePrompt prompt;
prompt.getHidden("Passphrase");
prompt.waitForFinished();
QCA:SecureArray pass = prompt.result();

Note
  It is not necessary to use waitForFinished(), because you can just connect the finished() signal to a suitable method, however command line (console) applications often require waitForFinished().

Examples:
  keyloader.cpp, and saslclient.cpp.

## Constructor & Destructor Documentation

## ◆ ConsolePrompt()

QCA::ConsolePrompt::ConsolePrompt | ( | QObject * | parent = `0` | ) |

Standard constructor.

Parameters

  parent | the parent object for this object

## Member Function Documentation

## ◆ getHidden()

void QCA::ConsolePrompt::getHidden | ( | const QString & | promptStr | ) |

Allow the user to enter data without it being echo'd to the terminal.

This is particularly useful for entry of passwords, passphrases and PINs.

Parameters

  promptStr | the prompt to display to the user

See also
  result() for how to get the input back.

Examples:
  keyloader.cpp, and saslclient.cpp.

## ◆ getChar()

void QCA::ConsolePrompt::getChar | ( |  | ) |

Obtain one character from the user.

See also
  resultChar() for how to get the input back.

## ◆ waitForFinished()

void QCA::ConsolePrompt::waitForFinished | ( |  | ) |

Block waiting for user input.

You may wish to use the finished() signal to avoid blocking.

Examples:
  keyloader.cpp, and saslclient.cpp.

## ◆ result()

SecureArray QCA::ConsolePrompt::result | ( |  | ) | const

Obtain the result of the user input.

This method is usually called to obtain data from the user that was requested by the getHidden() call.

Examples:
  keyloader.cpp, and saslclient.cpp.

## ◆ resultChar()

QChar QCA::ConsolePrompt::resultChar | ( |  | ) | const

Obtain the result of the user input.

This method is usually called to obtain data from the user that was requested by the getChar() call.

## ◆ finished

void QCA::ConsolePrompt::finished | ( |  | ) |
| signal

Emitted when the user input activity has been completed.

This corresponds to the provision of a string for getHidden() or a single character for getChar().

See also
  waitForFinished

The documentation for this class was generated from the following file:

- qca_support.h