Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

Sailfish Crypto

API Documentation
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Properties
  • Public Functions
  • Reimplemented Public Functions
  • Detailed Description

DhKeyPairGenerationParameters Class

(Sailfish::Crypto::DhKeyPairGenerationParameters)

Encapsulates parameters related to the generation of an asymmetric cryptographic key pair based on the Diffie-Hellman algorithm More...

Header: #include <Crypto/keypairgenerationparameters.h>
Inherits: KeyPairGenerationParameters
  • List of all members, including inherited members

Properties

  • base : QByteArray
  • generateFamilyParameters : bool
  • modulus : QByteArray
  • modulusLength : int
  • privateExponentLength : int
  • 2 properties inherited from Sailfish::Crypto::KeyPairGenerationParameters

Public Functions

DhKeyPairGenerationParameters()
DhKeyPairGenerationParameters(const KeyPairGenerationParameters &other)
~DhKeyPairGenerationParameters()
QByteArray base() const
bool generateFamilyParameters() const
QByteArray modulus() const
int modulusLength() const
int privateExponentLength() const
void setBase(const QByteArray &g)
void setGenerateFamilyParameters(bool generate)
void setModulus(const QByteArray &p)
void setModulusLength(int length)
void setPrivateExponentLength(int length)
DhKeyPairGenerationParameters &operator=(const DhKeyPairGenerationParameters &other)

Reimplemented Public Functions

virtual bool isValid() const
  • 7 public functions inherited from Sailfish::Crypto::KeyPairGenerationParameters

Detailed Description

Encapsulates parameters related to the generation of an asymmetric cryptographic key pair based on the Diffie-Hellman algorithm

This class encapsulates a variety of parameters which will affect how the crypto plugin generates a key pair. Usually, an instance of this class will be used when performing a GenerateStoredKeyRequest.

An example of parameters to generate a 3072-bit DH key pair using the key family parameters specified in FIPS-186-3 follows:

 Sailfish::Crypto::DhKeyPairGenerationParameters dhkpgParams;
 dhkpgParams.setModulusLength(3072);
 dhkpgParams.setPrivateExponentLength(256);
 dhkpgParams.setGenerateFamilyParameters(false);

Alternatively, the algorithm parameters may be specified explicitly via setting the modulus() and base() values:

 Sailfish::Crypto::DhKeyPairGenerationParameters dhkpgParams;
 dhkpgParams.setModulus(modulusData);
 dhkpgParams.setBase(baseData);

Property Documentation

base : QByteArray

Access functions:

QByteArray base() const
void setBase(const QByteArray &g)

generateFamilyParameters : bool

Access functions:

bool generateFamilyParameters() const
void setGenerateFamilyParameters(bool generate)

modulus : QByteArray

Access functions:

QByteArray modulus() const
void setModulus(const QByteArray &p)

modulusLength : int

Access functions:

int modulusLength() const
void setModulusLength(int length)

privateExponentLength : int

Access functions:

int privateExponentLength() const
void setPrivateExponentLength(int length)

Member Function Documentation

DhKeyPairGenerationParameters::DhKeyPairGenerationParameters()

Constructs a new DhKeyPairGenerationParameters instance

DhKeyPairGenerationParameters::DhKeyPairGenerationParameters(const KeyPairGenerationParameters &other)

Constructs a copy of the other parameters

DhKeyPairGenerationParameters::~DhKeyPairGenerationParameters()

Destroys the parameters instance

QByteArray DhKeyPairGenerationParameters::base() const

Returns the base generator to be used when generating the key pair

The base is also known as the generator G.

Note: Getter function for property base.

See also setBase().

bool DhKeyPairGenerationParameters::generateFamilyParameters() const

Returns true if the key should be generated using randomly-generated key family parameters

The individual parameters (modulus (prime p), private exponent (prime q), and base (generator g)) define the key family. In order for the algorithm to work, both parties need to use the same parameters in order for their (randomly generated public and private) keys to belong to the same family (and thus work).

If this value is true, the client wants the plugin to generate a key pair using randomly generated key family parameters; otherwise, the client wants the plugin to generate a key pair using the standard key family values specified in FIPS 186-3.

This value is only meaningful if the client has provided a modulusLength() and privateExponentLength(), and is ignored if the client has instead provided a modulus() and base().

Note: Getter function for property generateFamilyParameters.

See also setGenerateFamilyParameters().

[virtual] bool DhKeyPairGenerationParameters::isValid() const

QByteArray DhKeyPairGenerationParameters::modulus() const

Returns the modulus to be used when generating the key pair

The modulus is also known as the large prime P.

Note: Getter function for property modulus.

See also setModulus().

int DhKeyPairGenerationParameters::modulusLength() const

Returns the modulus length of the DH key pair to be generated

This defines the security size of the output key.

Note that this parameter is only meaningful if the client has not provided explicit values for the modulus() and base().

Note: Getter function for property modulusLength.

See also setModulusLength().

int DhKeyPairGenerationParameters::privateExponentLength() const

Returns the private exponent length of the DH key pair to be generated

This is the length (in bits) of the private exponent which will be generated by the base (generator).

Note that this parameter is only meaningful if the client has not provided explicit values for the modulus() and base().

Note: Getter function for property privateExponentLength.

See also setPrivateExponentLength().

void DhKeyPairGenerationParameters::setBase(const QByteArray &g)

Sets the base generator to be used when generating the key pair g

Note: Setter function for property base.

See also base().

void DhKeyPairGenerationParameters::setGenerateFamilyParameters(bool generate)

Sets whether the key should be generated using randomly-generated key family parameters to generate

Note: Setter function for property generateFamilyParameters.

See also generateFamilyParameters().

void DhKeyPairGenerationParameters::setModulus(const QByteArray &p)

Sets the modulus to be used when generating the key pair to p

Note: Setter function for property modulus.

See also modulus().

void DhKeyPairGenerationParameters::setModulusLength(int length)

Sets the modulus length of the DH key pair to be generated to length

Note: Setter function for property modulusLength.

See also modulusLength().

void DhKeyPairGenerationParameters::setPrivateExponentLength(int length)

Sets the private exponent length of the DH key pair to be generated to length

Note: Setter function for property privateExponentLength.

See also privateExponentLength().

DhKeyPairGenerationParameters &DhKeyPairGenerationParameters::operator=(const DhKeyPairGenerationParameters &other)

Assigns the other parameters to this instance

  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn