# QCA::PasswordAsker Class Reference
[QCA user API]

User password / passphrase / PIN handler. More...

`#include <QtCrypto>`

Inheritance diagram for QCA::PasswordAsker:

Collaboration diagram for QCA::PasswordAsker:

[legend]

List of all members.

## Signals

void | responseReady ()

## Public Member Functions

bool | accepted () const
void | ask (Event::PasswordStyle pstyle, const QString &fileName, void *ptr)
void | ask (Event::PasswordStyle pstyle, const KeyStoreInfo &keyStoreInfo, const KeyStoreEntry &keyStoreEntry, void *ptr)
void | cancel ()
SecureArray | password () const
| PasswordAsker (QObject *parent=0)
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

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

Construct a new asker.

Parameters:

  | parent | the parent object for this QObject

## Member Function Documentation

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.

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

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.

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

Cancel the pending password / passphrase request.

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.

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().

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.

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

- qca_core.h