Qt Cryptographic Architecture
Signals | Public Member Functions | Friends | List of all members
QCA::PasswordAsker Class Reference

#include <QtCrypto>

Collaboration diagram for QCA::PasswordAsker:
Collaboration graph
[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
parentthe parent object for this QObject

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
pstylethe type of information required (e.g. PIN, passphrase or password)
keyStoreInfoinfo of the key store that the information is required for
keyStoreEntrythe item in the key store that the information is required for (if applicable)
ptropaque 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
pstylethe type of information required (e.g. PIN, passphrase or password)
fileNamethe name of the file that the information is required for
ptropaque 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().


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