Skip to content

Commit

Permalink
[auth] Add error trap and debug fixes for PKCS#12 auth method
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Oct 18, 2017
1 parent a406739 commit 025c6f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/auth/pkipkcs12/qgsauthpkcs12method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ QgsPkiConfigBundle *QgsAuthPkcs12Method::getPkiConfigBundle( const QString &auth
QStringList bundlelist = QgsAuthCertUtils::pkcs12BundleToPem( mconfig.config( QStringLiteral( "bundlepath" ) ),
mconfig.config( QStringLiteral( "bundlepass" ) ), false );

if ( bundlelist.isEmpty() || bundlelist.size() < 2 )
{
QgsDebugMsg( QString( "PKI bundle for authcfg %1: insert FAILED, PKCS#12 bundle parsing failed" ).arg( authcfg ) );
return bundle;
}

// init client cert
// Note: if this is not valid, no sense continuing
QSslCertificate clientcert( bundlelist.at( 0 ).toLatin1() );
Expand All @@ -291,6 +297,11 @@ QgsPkiConfigBundle *QgsAuthPkcs12Method::getPkiConfigBundle( const QString &auth
return bundle;
}

// !!! DON'T LEAVE THESE UNCOMMENTED !!!
// QgsDebugMsg( QString( "PKI bundle key for authcfg: \n%1" ).arg( bundlelist.at( 1 ) ) );
// QgsDebugMsg( QString( "PKI bundle key pass for authcfg: \n%1" )
// .arg( !mconfig.config( QStringLiteral( "bundlepass" ) ).isNull() ? mconfig.config( QStringLiteral( "bundlepass" ) ) : QStringLiteral() ) );

// init key
QSslKey clientkey( bundlelist.at( 1 ).toLatin1(),
QSsl::Rsa,
Expand Down

0 comments on commit 025c6f2

Please sign in to comment.