QCA
qca_publickey.h
Go to the documentation of this file.
60};
76 EMSA1_SHA1, ///< SHA1, with EMSA1 (IEEE1363-2000) encoding (this is the usual DSA algorithm - FIPS186)
78 EMSA3_MD5, ///< MD5, with EMSA3 (ie PKCS#1 Version 1.5) encoding (this is the usual RSA algorithm)
81 EMSA3_Raw, ///< EMSA3 without computing a message digest or a DigestInfo encoding (identical to PKCS#11's
87};
97};
110};
124};
148};
162QCA_EXPORT QByteArray emsa3Encode(const QString &hashName, const QByteArray &digest, int size = -1);
261 };
751 static PublicKey fromDER(const QByteArray &a, ConvertResult *result = nullptr, const QString &provider = QString());
778 static PublicKey fromPEM(const QString &s, ConvertResult *result = nullptr, const QString &provider = QString());
808 fromPEMFile(const QString &fileName, ConvertResult *result = nullptr, const QString &provider = QString());
974 QByteArray signMessage(const MemoryRegion &a, SignatureAlgorithm alg, SignatureFormat format = DefaultFormat);
1002 SecureArray toDER(const SecureArray &passphrase = SecureArray(), PBEAlgorithm pbe = PBEDefault) const;
1016 QString toPEM(const SecureArray &passphrase = SecureArray(), PBEAlgorithm pbe = PBEDefault) const;
1455 DSAPrivateKey(const DLGroup &domain, const BigInteger &y, const BigInteger &x, const QString &provider = QString());
1542 DHPrivateKey(const DLGroup &domain, const BigInteger &y, const BigInteger &x, const QString &provider = QString());
DHPrivateKey(const DLGroup &domain, const BigInteger &y, const BigInteger &x, const QString &provider=QString())
Create a Diffie-Hellman private key.
DHPublicKey(const DLGroup &domain, const BigInteger &y, const QString &provider=QString())
Create a Diffie-Hellman public key.
DHPublicKey(const DHPrivateKey &k)
Create a Diffie-Hellman public key from a specified private key.
static QList< DLGroupSet > supportedGroupSets(const QString &provider=QString())
Provide a list of the supported group sets.
DLGroup(const BigInteger &p, const BigInteger &g)
Construct a discrete logarithm group from raw parameters.
DLGroup(const BigInteger &p, const BigInteger &q, const BigInteger &g)
Construct a discrete logarithm group from raw parameters.
DSAPrivateKey(const DLGroup &domain, const BigInteger &y, const BigInteger &x, const QString &provider=QString())
Create a DSA public key.
DSAPublicKey(const DSAPrivateKey &k)
Create a DSA public key from a specified private key.
DSAPublicKey(const DLGroup &domain, const BigInteger &y, const QString &provider=QString())
Create a DSA public key.
PrivateKey createDH(const DLGroup &domain, const QString &provider=QString())
Generate a Diffie-Hellman key.
bool blockingEnabled() const
Test whether the key generator is set to operate in blocking mode, or not.
PrivateKey createDSA(const DLGroup &domain, const QString &provider=QString())
Generate a DSA key.
PrivateKey createRSA(int bits, int exp=65537, const QString &provider=QString())
Generate an RSA key of the specified length.
DLGroup createDLGroup(QCA::DLGroupSet set, const QString &provider=QString())
Create a new discrete logarithm group.
void setBlockingEnabled(bool b)
Set whether the key generator is in blocking mode, nor not.
General superclass for public (PublicKey) and private (PrivateKey) keys used with asymmetric encrypti...
Definition qca_publickey.h:251
static QList< Type > supportedIOTypes(const QString &provider=QString())
Test what types of keys are supported for IO operations.
RSAPrivateKey toRSAPrivateKey() const
Interpret this key as an RSAPrivateKey.
static QList< Type > supportedTypes(const QString &provider=QString())
Test what types of keys are supported.
PKey(const QString &type, const QString &provider)
Create a key of the specified type.
DSAPrivateKey toDSAPrivateKey() const
Interpret this key as a DSAPrivateKey.
static PrivateKey fromPEM(const QString &s, const SecureArray &passphrase=SecureArray(), ConvertResult *result=nullptr, const QString &provider=QString())
Import the key from Privacy Enhanced Mail (PEM) format.
PrivateKey(const QString &fileName, const SecureArray &passphrase=SecureArray())
Import a private key from a PEM representation in a file.
bool toPEMFile(const QString &fileName, const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const
Export the key in Privacy Enhanced Mail (PEM) format to a file.
static QList< PBEAlgorithm > supportedPBEAlgorithms(const QString &provider=QString())
List the supported Password Based Encryption Algorithms that can be used to protect the key.
bool decrypt(const SecureArray &in, SecureArray *out, EncryptionAlgorithm alg)
Decrypt the message.
SecureArray encrypt(const SecureArray &a, EncryptionAlgorithm alg)
Encrypt a message using a specified algorithm.
QByteArray signMessage(const MemoryRegion &a, SignatureAlgorithm alg, SignatureFormat format=DefaultFormat)
One step signature process.
PrivateKey(const QString &type, const QString &provider)
Create a new private key.
int maximumEncryptSize(EncryptionAlgorithm alg) const
The maximum message size that can be encrypted with a specified algorithm.
static PrivateKey fromPEMFile(const QString &fileName, const SecureArray &passphrase=SecureArray(), ConvertResult *result=nullptr, const QString &provider=QString())
Import the key in Privacy Enhanced Mail (PEM) format from a file.
SecureArray toDER(const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const
Export the key in Distinguished Encoding Rules (DER) format.
void startSign(SignatureAlgorithm alg, SignatureFormat format=DefaultFormat)
Initialise the message signature process.
SymmetricKey deriveKey(const PublicKey &theirs)
Derive a shared secret key from a public key.
static PrivateKey fromDER(const SecureArray &a, const SecureArray &passphrase=SecureArray(), ConvertResult *result=nullptr, const QString &provider=QString())
Import the key from Distinguished Encoding Rules (DER) format.
QString toPEM(const SecureArray &passphrase=SecureArray(), PBEAlgorithm pbe=PBEDefault) const
Export the key in Privacy Enhanced Mail (PEM) format.
void update(const MemoryRegion &a)
Update the signature verification process with more data.
DSAPublicKey toDSA() const
Convenience method to convert this key to a DSAPublicKey.
RSAPublicKey toRSA() const
Convenience method to convert this key to an RSAPublicKey.
bool verifyMessage(const MemoryRegion &a, const QByteArray &sig, SignatureAlgorithm alg, SignatureFormat format=DefaultFormat)
Single step message verification.
PublicKey(const QString &type, const QString &provider)
Create a new key of a specified type.
QByteArray toDER() const
Export the key in Distinguished Encoding Rules (DER) format.
bool validSignature(const QByteArray &sig)
Check the signature is valid for the message.
DHPublicKey toDH() const
Convenience method to convert this key to a DHPublicKey.
static PublicKey fromPEM(const QString &s, ConvertResult *result=nullptr, const QString &provider=QString())
Import a key in Privacy Enhanced Mail (PEM) format.
static PublicKey fromPEMFile(const QString &fileName, ConvertResult *result=nullptr, const QString &provider=QString())
Import a key in Privacy Enhanced Mail (PEM) format from a file.
bool decrypt(const SecureArray &in, SecureArray *out, EncryptionAlgorithm alg)
Decrypt the message.
bool toPEMFile(const QString &fileName) const
Export the key in Privacy Enhanced Mail (PEM) to a file.
void startVerify(SignatureAlgorithm alg, SignatureFormat format=DefaultFormat)
Initialise the signature verification process.
static PublicKey fromDER(const QByteArray &a, ConvertResult *result=nullptr, const QString &provider=QString())
Import a key in Distinguished Encoding Rules (DER) format.
PublicKey(const PrivateKey &k)
Create a public key based on a specified private key.
bool canVerify() const
Test if the key can be used for verifying signatures.
int maximumEncryptSize(EncryptionAlgorithm alg) const
The maximum message size that can be encrypted with a specified algorithm.
PublicKey(const QString &fileName)
Import a public key from a PEM representation in a file.
SecureArray encrypt(const SecureArray &a, EncryptionAlgorithm alg)
Encrypt a message using a specified algorithm.
BigInteger q() const
The second of the two random primes used to generate the private key.
BigInteger p() const
One of the two random primes used to generate the private key.
RSAPrivateKey(const BigInteger &n, const BigInteger &e, const BigInteger &p, const BigInteger &q, const BigInteger &d, const QString &provider=QString())
Generate an RSA private key from specified parameters.
RSAPublicKey(const BigInteger &n, const BigInteger &e, const QString &provider=QString())
Generate an RSA public key from specified parameters.
RSAPublicKey(const RSAPrivateKey &k)
Extract the public key components from an RSA private key.
@ EME_PKCS1v15_SSL
PKCS#1, Version 1.5 with an SSL-specific modification.
Definition qca_publickey.h:58
@ EME_PKCS1_OAEP
Optimal asymmetric encryption padding (PKCS#1, Version 2.0)
Definition qca_publickey.h:57
QCA_EXPORT QByteArray emsa3Encode(const QString &hashName, const QByteArray &digest, int size=-1)
Encode a hash result in EMSA3 (PKCS#1) format.
@ EMSA3_RIPEMD160
RIPEMD160, with EMSA3 (ie PKCS#1 Version 1.5) encoding.
Definition qca_publickey.h:80
@ EMSA3_Raw
EMSA3 without computing a message digest or a DigestInfo encoding (identical to PKCS#11's CKM_RSA_PKC...
Definition qca_publickey.h:81
@ EMSA1_SHA1
SHA1, with EMSA1 (IEEE1363-2000) encoding (this is the usual DSA algorithm - FIPS186)
Definition qca_publickey.h:76
@ EMSA3_MD5
MD5, with EMSA3 (ie PKCS#1 Version 1.5) encoding (this is the usual RSA algorithm)
Definition qca_publickey.h:78
Header file for core QCA infrastructure.
PublicKey
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.