QCA::KeyGenerator Class Reference
QCA user API

`#include <QtCrypto>`

Collaboration diagram for QCA::KeyGenerator:
[legend]

## Signals

void | finished ()

## Public Member Functions

bool | blockingEnabled () const
PrivateKey | createDH (const DLGroup &domain, const QString &provider=QString())
DLGroup | createDLGroup (QCA::DLGroupSet set, const QString &provider=QString())
PrivateKey | createDSA (const DLGroup &domain, const QString &provider=QString())
PrivateKey | createRSA (int bits, int exp=65537, const QString &provider=QString())
DLGroup | dlGroup () const
bool | isBusy () const
PrivateKey | key () const
| KeyGenerator (QObject *parent=nullptr)
void | setBlockingEnabled (bool b)

## Friends

class | Private

## Detailed Description

Class for generating asymmetric key pairs.

This class is used for generating asymmetric keys (public/private key pairs).

Examples
  rsatest.cpp.

## Constructor & Destructor Documentation

## KeyGenerator()

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

Create a new key generator.

Parameters

  parent | the parent object, if applicable

References KeyGenerator().

Referenced by finished(), and KeyGenerator().

## Member Function Documentation

## blockingEnabled()

bool QCA::KeyGenerator::blockingEnabled | ( |  | ) | const

Test whether the key generator is set to operate in blocking mode, or not.

Returns
  true if the key generator is in blocking mode

See also
  setBlockingEnabled

## setBlockingEnabled()

void QCA::KeyGenerator::setBlockingEnabled | ( | bool | b | ) |

Set whether the key generator is in blocking mode, nor not.

Parameters

  b | if true, the key generator will be set to operate in blocking mode, otherwise it will operate in non-blocking mode

See also
  blockingEnabled()

## isBusy()

bool QCA::KeyGenerator::isBusy | ( |  | ) | const

Test if the key generator is currently busy, or not.

Returns
  true if the key generator is busy generating a key already

## createRSA()

PrivateKey QCA::KeyGenerator::createRSA | ( | int | bits,
|  | int | exp = 65537,
|  | const QString & | provider = QString() )

Generate an RSA key of the specified length.

This method creates both the public key and corresponding private key. You almost certainly want to extract the public key part out - see PKey::toPublicKey for an easy way.

Key length is a tricky judgment - using less than 2048 is probably being too liberal for long term use. Don't use less than 1024 without serious analysis.

Parameters

  bits | the length of key that is required
  exp | the exponent - typically 3, 17 or 65537
  provider | the name of the provider to use, if a particular provider is required

Examples
  rsatest.cpp.

## createDSA()

PrivateKey QCA::KeyGenerator::createDSA | ( | const DLGroup & | domain,
|  | const QString & | provider = QString() )

Generate a DSA key.

This method creates both the public key and corresponding private key. You almost certainly want to extract the public key part out - see PKey::toPublicKey for an easy way.

Parameters

  domain | the discrete logarithm group that this key should be generated from
  provider | the name of the provider to use, if a particular provider is required

Note
  Not every DLGroup makes sense for DSA. You should use one of DSA_512, DSA_768 and DSA_1024.

## createDH()

PrivateKey QCA::KeyGenerator::createDH | ( | const DLGroup & | domain,
|  | const QString & | provider = QString() )

Generate a Diffie-Hellman key.

This method creates both the public key and corresponding private key. You almost certainly want to extract the public key part out - see PKey::toPublicKey for an easy way.

Parameters

  domain | the discrete logarithm group that this key should be generated from
  provider | the name of the provider to use, if a particular provider is required

Note
  For compatibility, you should use one of the IETF_ groupsets as the domain argument.

## key()

PrivateKey QCA::KeyGenerator::key | ( |  | ) | const

Return the last generated key.

This is really only useful when you are working with non-blocking key generation

## createDLGroup()

DLGroup QCA::KeyGenerator::createDLGroup | ( | QCA::DLGroupSet | set,
|  | const QString & | provider = QString() )

Create a new discrete logarithm group.

Parameters

  set | the set of discrete logarithm parameters to generate from
  provider | the name of the provider to use, if a particular provider is required.

## dlGroup()

DLGroup QCA::KeyGenerator::dlGroup | ( |  | ) | const

The current discrete logarithm group.

## finished

void QCA::KeyGenerator::finished | ( |  | ) |

signal

Emitted when the key generation is complete.

This is only used in non-blocking mode

References KeyGenerator().

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

- qca_publickey.h