• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

qca

QCA::PrivateKey

QCA::PrivateKey Class Reference
[QCA user API]

Generic private key. More...

#include <QtCrypto>

Inheritance diagram for QCA::PrivateKey:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 PrivateKey (const PrivateKey &from)
 PrivateKey (const QString &fileName, const SecureArray &passphrase=SecureArray())
 PrivateKey ()
 ~PrivateKey ()
bool canDecrypt () const
bool canSign () const
bool decrypt (const SecureArray &in, SecureArray *out, EncryptionAlgorithm alg)
SymmetricKey deriveKey (const PublicKey &theirs)
PrivateKey & operator= (const PrivateKey &from)
QByteArray signature ()
QByteArray signMessage (const MemoryRegion &a, SignatureAlgorithm alg, SignatureFormat format=DefaultFormat)
void startSign (SignatureAlgorithm alg, SignatureFormat format=DefaultFormat)
SecureArray toDER (const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const
DHPrivateKey toDH () const
DSAPrivateKey toDSA () const
QString toPEM (const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const
bool toPEMFile (const QString &fileName, const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const
RSAPrivateKey toRSA () const
void update (const MemoryRegion &a)

Static Public Member Functions

static PrivateKey fromDER (const SecureArray &a, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString())
static PrivateKey fromPEM (const QString &s, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString())
static PrivateKey fromPEMFile (const QString &fileName, const SecureArray &passphrase=SecureArray(), ConvertResult *result=0, const QString &provider=QString())
static QList< PBEAlgorithm > supportedPBEAlgorithms (const QString &provider=QString())

Protected Member Functions

 PrivateKey (const QString &type, const QString &provider)

Detailed Description

Generic private key.

Definition at line 797 of file qca_publickey.h.


Constructor & Destructor Documentation

QCA::PrivateKey::PrivateKey (  ) 

Create an empty private key.

Definition at line 918 of file qca_publickey.cpp.

QCA::PrivateKey::PrivateKey ( const QString &  fileName,
const SecureArray &  passphrase = SecureArray() 
) [explicit]

Import a private key from a PEM representation in a file.

Parameters:
fileName the name of the file containing the private key
passphrase the pass phrase for the private key
See also:
fromPEMFile for an alternative method
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 927 of file qca_publickey.cpp.

QCA::PrivateKey::PrivateKey ( const PrivateKey &  from  ) 

Copy constructor.

Parameters:
from the PrivateKey to copy from

Definition at line 932 of file qca_publickey.cpp.

QCA::PrivateKey::~PrivateKey (  ) 

Definition at line 937 of file qca_publickey.cpp.

QCA::PrivateKey::PrivateKey ( const QString &  type,
const QString &  provider 
) [protected]

Create a new private key.

Parameters:
type the type of key to create
provider the provider to use, if a specific provider is required.

Definition at line 922 of file qca_publickey.cpp.


Member Function Documentation

bool QCA::PrivateKey::canDecrypt (  )  const

Test if this key can be used for decryption.

Returns:
true if the key can be used for decryption

Definition at line 962 of file qca_publickey.cpp.

bool QCA::PrivateKey::canSign (  )  const

Test if this key can be used for signing.

Returns:
true if the key can be used to make a signature

Definition at line 967 of file qca_publickey.cpp.

bool QCA::PrivateKey::decrypt ( const SecureArray &  in,
SecureArray *  out,
EncryptionAlgorithm  alg 
)

Decrypt the message.

Parameters:
in the cipher (encrypted) data
out the plain text data
alg the algorithm to use
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 972 of file qca_publickey.cpp.

SymmetricKey QCA::PrivateKey::deriveKey ( const PublicKey &  theirs  ) 

Derive a shared secret key from a public key.

Parameters:
theirs the public key to derive from

Definition at line 1001 of file qca_publickey.cpp.

PrivateKey QCA::PrivateKey::fromDER ( const SecureArray &  a,
const SecureArray &  passphrase = SecureArray(),
ConvertResult *  result = 0,
const QString &  provider = QString() 
) [static]

Import the key from Distinguished Encoding Rules (DER) format.

Parameters:
a the array containing the DER representation of the key
passphrase the pass phrase that is used to protect the key
result a pointer to a ConvertResult, that if specified, will be set to reflect the result of the import
provider the provider to use, if a particular provider is required
See also:
toDER provides an inverse of fromDER, exporting the key to an array
QCA::KeyLoader for an asynchronous loader approach.
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 1063 of file qca_publickey.cpp.

PrivateKey QCA::PrivateKey::fromPEM ( const QString &  s,
const SecureArray &  passphrase = SecureArray(),
ConvertResult *  result = 0,
const QString &  provider = QString() 
) [static]

Import the key from Privacy Enhanced Mail (PEM) format.

Parameters:
s the string containing the PEM representation of the key
passphrase the pass phrase that is used to protect the key
result a pointer to a ConvertResult, that if specified, will be set to reflect the result of the import
provider the provider to use, if a particular provider is required
See also:
toPEM provides an inverse of fromPEM, exporting the key to a string in PEM encoding.
QCA::KeyLoader for an asynchronous loader approach.
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 1068 of file qca_publickey.cpp.

PrivateKey QCA::PrivateKey::fromPEMFile ( const QString &  fileName,
const SecureArray &  passphrase = SecureArray(),
ConvertResult *  result = 0,
const QString &  provider = QString() 
) [static]

Import the key in Privacy Enhanced Mail (PEM) format from a file.

Parameters:
fileName the name (and path, if required) of the file containing the PEM representation of the key
passphrase the pass phrase that is used to protect the key
result a pointer to a ConvertResult, that if specified, will be set to reflect the result of the import
provider the provider to use, if a particular provider is required
See also:
toPEMFile provides an inverse of fromPEMFile
fromPEM which allows import from a string
QCA::KeyLoader for an asynchronous loader approach.
Note:
there is also a constructor form, that allows you to create the key directly
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 1073 of file qca_publickey.cpp.

PrivateKey & QCA::PrivateKey::operator= ( const PrivateKey &  from  ) 

Assignment operator.

Parameters:
from the PrivateKey to copy from

Reimplemented from QCA::PKey.

Definition at line 941 of file qca_publickey.cpp.

QByteArray QCA::PrivateKey::signature (  ) 

The resulting signature.

Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 989 of file qca_publickey.cpp.

QByteArray QCA::PrivateKey::signMessage ( const MemoryRegion &  a,
SignatureAlgorithm  alg,
SignatureFormat  format = DefaultFormat 
)

One step signature process.

Parameters:
a the message to sign
alg the algorithm to use for the signature
format the signature format to use, for DSA
Returns:
the signature
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 994 of file qca_publickey.cpp.

void QCA::PrivateKey::startSign ( SignatureAlgorithm  alg,
SignatureFormat  format = DefaultFormat 
)

Initialise the message signature process.

Parameters:
alg the algorithm to use for the message signature process
format the signature format to use, for DSA
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 977 of file qca_publickey.cpp.

QList< PBEAlgorithm > QCA::PrivateKey::supportedPBEAlgorithms ( const QString &  provider = QString()  )  [static]

List the supported Password Based Encryption Algorithms that can be used to protect the key.

Parameters:
provider the provider to use, if a particular provider is required

Definition at line 1007 of file qca_publickey.cpp.

SecureArray QCA::PrivateKey::toDER ( const SecureArray &  passphrase = SecureArray(),
PBEAlgorithm  pbe = PBEDefault 
) const

Export the key in Distinguished Encoding Rules (DER) format.

Parameters:
passphrase the pass phrase to use to protect the key
pbe the symmetric encryption algorithm to use to protect the key
See also:
fromDER provides an inverse of toDER, converting the DER encoded key back to a PrivateKey

Definition at line 1012 of file qca_publickey.cpp.

DHPrivateKey QCA::PrivateKey::toDH (  )  const

Interpret / convert the key to a Diffie-Hellman key.

Definition at line 957 of file qca_publickey.cpp.

DSAPrivateKey QCA::PrivateKey::toDSA (  )  const

Interpret / convert the key to a DSA key.

Definition at line 952 of file qca_publickey.cpp.

QString QCA::PrivateKey::toPEM ( const SecureArray &  passphrase = SecureArray(),
PBEAlgorithm  pbe = PBEDefault 
) const

Export the key in Privacy Enhanced Mail (PEM) format.

Parameters:
passphrase the pass phrase to use to protect the key
pbe the symmetric encryption algorithm to use to protect the key
See also:
toPEMFile provides a convenient way to save the PEM encoded key to a file
fromPEM provides an inverse of toPEM, converting the PEM encoded key back to a PrivateKey

Definition at line 1035 of file qca_publickey.cpp.

bool QCA::PrivateKey::toPEMFile ( const QString &  fileName,
const SecureArray &  passphrase = SecureArray(),
PBEAlgorithm  pbe = PBEDefault 
) const

Export the key in Privacy Enhanced Mail (PEM) format to a file.

Parameters:
fileName the name (and path, if required) that the key should be exported to.
passphrase the pass phrase to use to protect the key
pbe the symmetric encryption algorithm to use to protect the key
Returns:
true if the export succeeds
See also:
toPEM provides a convenient way to save the PEM encoded key to a file
fromPEM provides an inverse of toPEM, converting the PEM encoded key back to a PrivateKey

Definition at line 1058 of file qca_publickey.cpp.

RSAPrivateKey QCA::PrivateKey::toRSA (  )  const

Interpret / convert the key to an RSA key.

Definition at line 947 of file qca_publickey.cpp.

void QCA::PrivateKey::update ( const MemoryRegion &  a  ) 

Update the signature process.

Parameters:
a the message to use to update the signature
Note:
This synchronous operation may require event handling, and so it must not be called from the same thread as an EventHandler.

Definition at line 984 of file qca_publickey.cpp.


The documentation for this class was generated from the following files:
  • qca_publickey.h
  • qca_publickey.cpp

qca

Skip menu "qca"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal