本文整理汇总了C++中QSslKey::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QSslKey::type方法的具体用法?C++ QSslKey::type怎么用?C++ QSslKey::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSslKey
的用法示例。
在下文中一共展示了QSslKey::type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isKeyForCert
bool Server::isKeyForCert(const QSslKey &key, const QSslCertificate &cert) {
if (key.isNull() || cert.isNull() || (key.type() != QSsl::PrivateKey))
return false;
QByteArray qbaKey = key.toDer();
QByteArray qbaCert = cert.toDer();
X509 *x509 = NULL;
EVP_PKEY *pkey = NULL;
BIO *mem = NULL;
mem = BIO_new_mem_buf(qbaKey.data(), qbaKey.size());
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
pkey = d2i_PrivateKey_bio(mem, NULL);
BIO_free(mem);
mem = BIO_new_mem_buf(qbaCert.data(), qbaCert.size());
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
x509 = d2i_X509_bio(mem, NULL);
BIO_free(mem);
mem = NULL;
if (x509 && pkey && X509_check_private_key(x509, pkey)) {
EVP_PKEY_free(pkey);
X509_free(x509);
return true;
}
if (pkey)
EVP_PKEY_free(pkey);
if (x509)
X509_free(x509);
return false;
}
示例2: type
QSsl::KeyType QSslKeyProto::type() const
{
QSslKey *item = qscriptvalue_cast<QSslKey*>(thisObject());
if (item)
return item->type();
return QSsl::KeyType();
}
示例3: setClientKey
void QgsPkiBundle::setClientKey( const QSslKey &certkey )
{
mCertKey.clear();
if ( !certkey.isNull() && certkey.type() == QSsl::PrivateKey )
{
mCertKey = certkey;
}
}
示例4: saver
QDebug operator<<(QDebug debug, const QSslKey &key)
{
QDebugStateSaver saver(debug);
debug.resetFormat().nospace();
debug << "QSslKey("
<< (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey")
<< ", " << (key.algorithm() == QSsl::Opaque ? "OPAQUE" :
(key.algorithm() == QSsl::Rsa ? "RSA" : ((key.algorithm() == QSsl::Dsa) ? "DSA" : "EC")))
<< ", " << key.length()
<< ')';
return debug;
}