QCA::PasswordAsker Class Reference
QCA user API

`#include <QtCrypto>`

Collaboration diagram for QCA::PasswordAsker:
[legend]

## Signals

void | responseReady ()

## Public Member Functions

bool | accepted () const
void | ask (Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
void | ask (Event::PasswordStyle pstyle, const QString &fileName, void *ptr)
void | cancel ()
SecureArray | password () const
| PasswordAsker (QObject *parent=nullptr)
void | waitForResponse ()

## Friends

class | Private

## Detailed Description

User password / passphrase / PIN handler.

This class is used to obtain a password from a user.

Examples
  eventhandlerdemo.cpp.

## Constructor & Destructor Documentation

## PasswordAsker()

QCA::PasswordAsker::PasswordAsker | ( | QObject * | parent = nullptr | ) |

Construct a new asker.

Parameters

  parent | the parent object for this QObject

References PasswordAsker().

Referenced by PasswordAsker(), and responseReady().

## Member Function Documentation

## ask() [1/2]

void QCA::PasswordAsker::ask | ( | Event::PasswordStyle | pstyle,
|  | const KeyStoreInfo & | keyStoreInfo,
|  | const KeyStoreEntry & | keyStoreEntry,
|  | void * | ptr )

queue a password / passphrase request associated with a key store

Parameters

  pstyle | the type of information required (e.g. PIN, passphrase or password)
  keyStoreInfo | info of the key store that the information is required for
  keyStoreEntry | the item in the key store that the information is required for (if applicable)
  ptr | opaque data

Examples
  eventhandlerdemo.cpp.

## ask() [2/2]

void QCA::PasswordAsker::ask | ( | Event::PasswordStyle | pstyle,
|  | const QString & | fileName,
|  | void * | ptr )

queue a password / passphrase request associated with a file

Parameters

  pstyle | the type of information required (e.g. PIN, passphrase or password)
  fileName | the name of the file that the information is required for
  ptr | opaque data

## cancel()

void QCA::PasswordAsker::cancel | ( |  | ) |

Cancel the pending password / passphrase request.

## waitForResponse()

void QCA::PasswordAsker::waitForResponse | ( |  | ) |

Block until the password / passphrase request is completed.

You can use the responseReady signal instead of blocking, if appropriate.

Examples
  eventhandlerdemo.cpp.

## accepted()

bool QCA::PasswordAsker::accepted | ( |  | ) | const

Determine whether the password / passphrase was accepted or not.

In this context, returning true is indicative of the user clicking "Ok" or equivalent; and returning false indicates that either the user clicked "Cancel" or equivalent, or that the cancel() function was called, or that the request is still pending.

## password()

SecureArray QCA::PasswordAsker::password | ( |  | ) | const

The password / passphrase / PIN provided by the user in response to the asker request.

This may be empty.

Examples
  eventhandlerdemo.cpp.

## responseReady

void QCA::PasswordAsker::responseReady | ( |  | ) |

signal

Emitted when the asker process has been completed.

You should check whether the user accepted() the response prior to relying on the password().

References PasswordAsker().

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

- qca_core.h