Skip to content
Permalink
Browse files
sipify auth classes
  • Loading branch information
3nids committed May 23, 2017
1 parent e99f548 commit 00fcc6e0cd0a17aa81e452de42eee164dde152ab
@@ -3,10 +3,6 @@ core/qgsexception.sip
core/qgis.sip
core/qgsrange.sip
core/qgsvectorlayerfeatureiterator.sip
core/auth/qgsauthcertutils.sip
core/auth/qgsauthconfig.sip
core/auth/qgsauthmanager.sip
core/auth/qgsauthmethod.sip
core/composer/qgsaddremoveitemcommand.sip
core/composer/qgsgroupungroupitemscommand.sip
core/composer/qgsaddremovemultiframecommand.sip
@@ -1,34 +1,47 @@
/** \ingroup core
* \brief Utilities for working with certificates and keys
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/auth/qgsauthcertutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/








class QgsAuthCertUtils
{
%Docstring
Utilities for working with certificates and keys
%End

%TypeHeaderCode
#include <qgsauthcertutils.h>
#include "qgsauthcertutils.h"
%End
public:
/** Type of CA certificate source */
enum CaCertSource
{
SystemRoot = 0,
FromFile = 1,
InDatabase = 2,
Connection = 3
SystemRoot,
FromFile,
InDatabase,
Connection
};

/** Type of certificate trust policy */
enum CertTrustPolicy
{
DefaultTrust = 0,
Trusted = 1,
Untrusted = 2,
NoPolicy = 3
DefaultTrust,
Trusted,
Untrusted,
NoPolicy
};

/** Type of certificate usage */
enum CertUsageType
{
UndeterminedUsage = 0,
UndeterminedUsage,
AnyOrUnspecifiedUsage,
CertAuthorityUsage,
CertIssuerUsage,
@@ -41,170 +54,188 @@ class QgsAuthCertUtils
CRLSigningUsage
};

/** Type of certificate key group */
enum ConstraintGroup
{
KeyUsage = 0,
ExtendedKeyUsage = 1
KeyUsage,
ExtendedKeyUsage
};


/** SSL Protocol name strings per enum */
static QString getSslProtocolName( QSsl::SslProtocol protocol );
%Docstring
SSL Protocol name strings per enum
:rtype: str
%End

/** Map certificate sha1 to certificate as simple cache */
static QMap<QString, QSslCertificate> mapDigestToCerts( const QList<QSslCertificate> &certs );
%Docstring
Map certificate sha1 to certificate as simple cache
:rtype: QMap<str, QSslCertificate>
%End

/** Map certificates to their oraganization.
* @note not available in Python bindings
*/
// static QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );

/** Map SSL custom configs' certificate sha1 to custom config as simple cache
*/
static QMap<QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( const QList<QgsAuthConfigSslServer> &configs );
%Docstring
Map SSL custom configs' certificate sha1 to custom config as simple cache
:rtype: QMap<str, QgsAuthConfigSslServer>
%End

/** Map SSL custom configs' certificates to their oraganization.
* @note not available in Python bindings
*/
// static QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( const QList<QgsAuthConfigSslServer> &configs );

/** Return list of concatenated certs from a PEM or DER formatted file */
static QList<QSslCertificate> certsFromFile( const QString &certspath );
%Docstring
Return list of concatenated certs from a PEM or DER formatted file
:rtype: list of QSslCertificate
%End

/** Return first cert from a PEM or DER formatted file */
static QSslCertificate certFromFile( const QString &certpath );
%Docstring
Return first cert from a PEM or DER formatted file
:rtype: QSslCertificate
%End

/** Return non-encrypted key from a PEM or DER formatted file
* @param keypath File path to private key
* @param keypass Passphrase for private key
* @param algtype QString to set with resolved algorithm type
*/
static QSslKey keyFromFile( const QString &keypath,
const QString &keypass = QString(),
QString *algtype = 0 );
%Docstring
Return non-encrypted key from a PEM or DER formatted file
\param keypath File path to private key
\param keypass Passphrase for private key
\param algtype QString to set with resolved algorithm type
:rtype: QSslKey
%End

/** Return list of concatenated certs from a PEM Base64 text block */
static QList<QSslCertificate> certsFromString( const QString &pemtext );
%Docstring
Return list of concatenated certs from a PEM Base64 text block
:rtype: list of QSslCertificate
%End

/** Return list of certificate, private key and algorithm (as PEM text) from file path components
* @param certpath File path to certificate
* @param keypath File path to private key
* @param keypass Passphrase for private key
* @param reencrypt Whether to re-encrypt the private key with the passphrase
* @return certificate, private key, key's algorithm type
*/
static QStringList certKeyBundleToPem( const QString &certpath,
const QString &keypath,
const QString &keypass = QString(),
bool reencrypt = true );
%Docstring
Return list of certificate, private key and algorithm (as PEM text) from file path components
\param certpath File path to certificate
\param keypath File path to private key
\param keypass Passphrase for private key
\param reencrypt Whether to re-encrypt the private key with the passphrase
:return: certificate, private key, key's algorithm type
:rtype: list of str
%End

/** Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
* @param bundlepath File path to the PKCS bundle
* @param bundlepass Passphrase for bundle
* @param reencrypt Whether to re-encrypt the private key with the passphrase
* @return certificate, private key, key's algorithm type
*/
static QStringList pkcs12BundleToPem( const QString &bundlepath,
const QString &bundlepass = QString(),
bool reencrypt = true );
%Docstring
Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
\param bundlepath File path to the PKCS bundle
\param bundlepass Passphrase for bundle
\param reencrypt Whether to re-encrypt the private key with the passphrase
:return: certificate, private key, key's algorithm type
:rtype: list of str
%End

/** Write a temporary file for a PEM text of cert/key/CAs bundle component
* @param pemtext Component content as PEM text
* @param name Name of file
* @return File path to temporary file
*/
static QString pemTextToTempFile( const QString &name, const QByteArray &pemtext );
%Docstring
Write a temporary file for a PEM text of cert/key/CAs bundle component
\param pemtext Component content as PEM text
\param name Name of file
:return: File path to temporary file
:rtype: str
%End

/** Get the general name for CA source enum type
* @param source The enum source type for the CA
* @param single Whether to return singular or plural description
*/
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source, bool single = false );
%Docstring
Get the general name for CA source enum type
\param source The enum source type for the CA
\param single Whether to return singular or plural description
:rtype: str
%End

/** Get the general name via RFC 5280 resolution */
static QString resolvedCertName( const QSslCertificate &cert, bool issuer = false );
%Docstring
Get the general name via RFC 5280 resolution
:rtype: str
%End


/** Get combined distinguished name for certificate
* @param qcert Qt SSL cert object
* @param acert QCA SSL cert object to add more info to the output
* @param issuer Whether to return cert's subject or issuer combined name
* @note not available in Python bindings
*/
// static QString getCertDistinguishedName( const QSslCertificate& qcert,
// const QCA::Certificate& acert = QCA::Certificate(),
// bool issuer = false );

/** Get the general name for certificate trust */
static QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
%Docstring
Get the general name for certificate trust
:rtype: str
%End

/** Get string with colon delimiters every 2 characters */
static QString getColonDelimited( const QString &txt );
%Docstring
Get string with colon delimiters every 2 characters
:rtype: str
%End

static QString shaHexForCert( const QSslCertificate &cert, bool formatted = false );
%Docstring
Get the sha1 hash for certificate
\param cert Qt SSL certificate to generate hash from
\param formatted Whether to colon-delimit the hash
:rtype: str
%End








/** Get the sha1 hash for certificate
* @param cert Qt SSL certificate to generate hash from
* @param formatted Whether to colon-delimit the hash
*/
static QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );

/** Convert a QSslCertificate to a QCA::Certificate.
* @note not available in Python bindings
*/
// static QCA::Certificate qtCertToQcaCert( const QSslCertificate &cert );

/** Convert a QList of QSslCertificate to a QCA::CertificateCollection.
* @note not available in Python bindings
*/
// static QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate> &certs );

/** PKI key/cert bundle from file path, e.g. from .p12 or pfx files.
* @note not available in Python bindings
*/
// static QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );

/** Certificate validity check messages per enum.
* @note not available in Python bindings
*/
// static QString qcaValidityMessage( QCA::Validity validity );

/** Certificate signature algorithm strings per enum.
* @note not available in Python bindings
*/
// static QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );

/** Certificate well-known constraint strings per enum.
* @note not available in Python bindings
*/
// static QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );

/** Certificate usage type strings per enum
* @note not available in Python bindings
*/
static QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );

/** Try to determine the certificates usage types */
static QList<QgsAuthCertUtils::CertUsageType> certificateUsageTypes( const QSslCertificate &cert );
%Docstring
Try to determine the certificates usage types
:rtype: list of QgsAuthCertUtils.CertUsageType
%End

/** Get whether a certificate is an Authority */
static bool certificateIsAuthority( const QSslCertificate &cert );
%Docstring
Get whether a certificate is an Authority
:rtype: bool
%End

/** Get whether a certificate can sign other certificates */
static bool certificateIsIssuer( const QSslCertificate &cert );
%Docstring
Get whether a certificate can sign other certificates
:rtype: bool
%End

/** Get whether a certificate is an Authority or can at least sign other certificates */
static bool certificateIsAuthorityOrIssuer( const QSslCertificate &cert );
%Docstring
Get whether a certificate is an Authority or can at least sign other certificates
:rtype: bool
%End

/** Get whether a certificate is probably used for a SSL server */
static bool certificateIsSslServer( const QSslCertificate &cert );
%Docstring
Get whether a certificate is probably used for a SSL server
:rtype: bool
%End

/** Get whether a certificate is probably used for a client identity */
static bool certificateIsSslClient( const QSslCertificate &cert );
%Docstring
Get whether a certificate is probably used for a client identity
:rtype: bool
%End

/** Get short strings describing an SSL error */
static QString sslErrorEnumString( QSslError::SslError errenum );
%Docstring
Get short strings describing an SSL error
:rtype: str
%End


/** Get short strings describing SSL errors.
* @note not available in Python bindings
*/
// static QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/auth/qgsauthcertutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 00fcc6e

Please sign in to comment.