32 const QString QgsAuthMethodConfig::mConfigSep = 
"|||";
    33 const QString QgsAuthMethodConfig::mConfigKeySep = 
":::";
    34 const QString QgsAuthMethodConfig::mConfigListSep = 
"```";
    36 const int QgsAuthMethodConfig::mConfigVersion = 1;
    51   return ( other.
id() == 
id()
    61   return  !( *
this == other );
    66   bool idvalid = validateid ? !mId.
isEmpty() : 
true;
    81     confstrs << i.
key() + mConfigKeySep + i.
value();
    84   return confstrs.
join( mConfigSep );
    97   Q_FOREACH ( 
const QString& conf, confs )
    99     if ( conf.
contains( mConfigKeySep ) )
   102       setConfig( keyval.at( 0 ), keyval.at( 1 ) );
   108     setConfig( 
"oldconfigstyle", configstr );
   114   mConfigMap.
insert( key, value );
   124   return mConfigMap.
remove( key );
   129   return mConfigMap.
value( key, defaultvalue );
   147     QUrl url( accessurl );
   151             .arg( url.
port() ).arg( withpath ? url.
path() : 
"" );
   159 #ifndef QT_NO_OPENSSL   170     , mCaChain( caChain )
   184       openflags |= QIODevice::Text;
   185     bool ret = file.
open( openflags );
   202        && ( certPath.
endsWith( 
".pem", Qt::CaseInsensitive )
   203             || certPath.
endsWith( 
".der", Qt::CaseInsensitive ) )
   204        && ( keyPath.
endsWith( 
".pem", Qt::CaseInsensitive )
   205             || keyPath.
endsWith( 
".der", Qt::CaseInsensitive ) )
   210     bool pem = certPath.
endsWith( 
".pem", Qt::CaseInsensitive );
   215     bool pem_key = keyPath.
endsWith( 
".pem", Qt::CaseInsensitive );
   221                          pem_key ? QSsl::Pem : QSsl::Der,
   229                            pem_key ? QSsl::Pem : QSsl::Der,
   246   if ( QCA::isSupported( 
"pkcs12" )
   248        && ( bundlepath.
endsWith( 
".p12", Qt::CaseInsensitive )
   249             || bundlepath.
endsWith( 
".pfx", Qt::CaseInsensitive ) )
   252     QCA::SecureArray passarray;
   253     if ( !bundlepass.
isNull() )
   254       passarray = QCA::SecureArray( bundlepass.
toUtf8() );
   255     QCA::ConvertResult res;
   256     QCA::KeyBundle bundle( QCA::KeyBundle::fromFile( bundlepath, passarray, &res, 
QString( 
"qca-ossl" ) ) );
   257     if ( res == QCA::ConvertGood && !bundle.isNull() )
   259       QCA::CertificateChain cert_chain( bundle.certificateChain() );
   261       if ( !cert.isNull() )
   265       QSslKey cert_key( bundle.privateKey().toPEM().toAscii(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, 
QByteArray() );
   266       if ( !cert_key.isNull() )
   271       if ( cert_chain.size() > 1 )
   274         Q_FOREACH ( 
const QCA::Certificate& ca_cert, cert_chain )
   276           if ( ca_cert != cert_chain.primary() )
   303     return QString::null;
   320   if ( !certkey.
isNull() && certkey.
type() == QSsl::PrivateKey )
   336     , mCertKey( certkey )
   350 const QString QgsAuthConfigSslServer::mConfSep = 
"|||";
   356     , mSslPeerVerifyMode( 
QSslSocket::VerifyPeer )
   357     , mSslPeerVerifyDepth( 0 )
   361 #if QT_VERSION >= 0x040800   365   mSslProtocol = QSsl::SecureProtocols;
   371   mSslProtocol = QSsl::TlsV1;
   390   configlist << QString::number( static_cast< int >( mSslProtocol ) );
   393   Q_FOREACH ( 
const QSslError::SslError& err, mSslIgnoredErrors )
   395     errs << QString::number( static_cast< int >( err ) );
   397   configlist << errs.
join( 
"~~" );
   399   configlist << 
QString( 
"%1~~%2" ).
arg( static_cast< int >( mSslPeerVerifyMode ) ).
arg( mSslPeerVerifyDepth );
   401   return configlist.
join( mConfSep );
   412   mVersion = configlist.at( 0 ).toInt();
   413   mQtVersion = configlist.at( 1 ).toInt();
   417   mSslProtocol = 
static_cast< QSsl::SslProtocol 
>( configlist.at( 2 ).toInt() );
   419   mSslIgnoredErrors.
clear();
   420   QStringList errs( configlist.at( 3 ).split( 
"~~" ) );
   421   Q_FOREACH ( 
const QString& err, errs )
   423     mSslIgnoredErrors.
append( static_cast< QSslError::SslError >( err.
toInt() ) );
   426   QStringList peerverify( configlist.at( 4 ).split( 
"~~" ) );
   427   mSslPeerVerifyMode = 
static_cast< QSslSocket::PeerVerifyMode 
>( peerverify.at( 0 ).toInt() );
   428   mSslPeerVerifyDepth = peerverify.at( 1 ).toInt();
 
bool isValid() const
Whether the bundle is valid. 
 
QSsl::KeyType type() const
 
bool isNull() const
Whether configuration is null (missing components) 
 
QgsStringMap configMap() const
Get extended configuration, mapped to key/value pairs of QStrings. 
 
bool isNull() const
Whether the bundle, either its certificate or private key, is null. 
 
bool isValid(bool validateid=false) const
Whether the configuration is valid. 
 
void setConfig(const QString &key, const QString &value)
Set a single config value per key in the map. 
 
bool contains(const Key &key) const
 
QString config(const QString &key, const QString &defaultvalue=QString()) const
Return a config's value. 
 
void setCaChain(const QList< QSslCertificate > &cachain)
Set chain of Certificate Authorities for client certificate. 
 
static const QgsPkiBundle fromPkcs12Paths(const QString &bundlepath, const QString &bundlepass=QString::null)
Construct a bundle of PKI components from a PKCS#12 file path. 
 
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
 
const_iterator constBegin() const
 
QString join(const QString &separator) const
 
void setConfigList(const QString &key, const QStringList &value)
Set a multiple config values per key in the map. 
 
QStringList configList(const QString &key) const
Return a config's list of values. 
 
Storage set for PKI bundle: SSL certificate, key, optional CA cert chain. 
 
static QByteArray fileData_(const QString &path, bool astext=false)
 
QString number(int n, int base)
 
void setClientCert(const QSslCertificate &cert)
Set client certificate object. 
 
void append(const T &value)
 
Configuration storage class for authentication method configurations. 
 
const QList< QSslError > sslIgnoredErrors() const
SSL server errors to ignore in connections. 
 
int toInt(bool *ok, int base) const
 
const QString configString() const
Configuration as a concatenated string. 
 
const_iterator constEnd() const
 
const QString certId() const
The sha hash of the client certificate. 
 
QgsAuthConfigSslServer()
Construct a default SSL server configuration. 
 
void loadConfigString(const QString &configstr)
Load existing extended configuration. 
 
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
 
const QString name() const
Get name of configuration. 
 
bool isValid()
Whether the bundle is valid. 
 
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
 
const QList< QSslError::SslError > sslIgnoredErrorEnums() const
SSL server errors (as enum list) to ignore in connections. 
 
int version() const
Get version of the configuration. 
 
bool contains(QChar ch, Qt::CaseSensitivity cs) const
 
void setClientKey(const QSslKey &certkey)
Set private key object. 
 
static QString shaHexForCert(const QSslCertificate &cert, bool formatted=false)
Get the sha1 hash for certificate. 
 
QgsAuthMethodConfig(const QString &method=QString(), int version=0)
Construct a configuration for an authentication method. 
 
bool operator!=(const QgsAuthMethodConfig &other) const
Operator used to compare configs' inequality. 
 
static bool uriToResource(const QString &accessurl, QString *resource, bool withpath=false)
A utility function for generating a resource from a URL to be compared against the config's uri() for...
 
const QList< QSslCertificate > caChain() const
Chain of Certificate Authorities for client certificate. 
 
bool hasConfig(const QString &key) const
Whether a config key exists in config map. 
 
QString method() const
Textual key of the associated authentication method. 
 
void loadConfigString(const QString &config=QString())
Load concatenated string into configuration, e.g. 
 
int removeConfig(const QString &key)
Remove a config from map. 
 
QgsPkiConfigBundle(const QgsAuthMethodConfig &config, const QSslCertificate &cert, const QSslKey &certkey)
Construct a bundle from existing PKI components and authentication method configuration. 
 
const QString uri() const
A URI to auto-select a config when connecting to a resource. 
 
iterator insert(const Key &key, const T &value)
 
void clearConfigMap()
Clear all configs. 
 
bool operator==(const QgsAuthMethodConfig &other) const
Operator used to compare configs' equality. 
 
static const QgsPkiBundle fromPemPaths(const QString &certPath, const QString &keyPath, const QString &keyPass=QString::null, const QList< QSslCertificate > &caChain=QList< QSslCertificate >())
Construct a bundle of PKI components from PEM-formatted file paths. 
 
const QString configString() const
The extended configuration, as stored and retrieved from the authentication database. 
 
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
 
QgsPkiBundle(const QSslCertificate &clientCert=QSslCertificate(), const QSslKey &clientKey=QSslKey(), const QList< QSslCertificate > &caChain=QList< QSslCertificate >())
Construct a bundle from existing PKI components. 
 
const QString id() const
Get 'authcfg' 7-character alphanumeric ID of the config. 
 
const T value(const Key &key) const
 
int remove(const Key &key)
 
QByteArray toUtf8() const