certmanager/lib
qgpgmeverifydetachedjob.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifdef HAVE_CONFIG_H
00034 #include <config.h>
00035 #endif
00036
00037 #include "qgpgmeverifydetachedjob.h"
00038
00039 #include <qgpgme/eventloopinteractor.h>
00040 #include <qgpgme/dataprovider.h>
00041
00042 #include <gpgmepp/context.h>
00043 #include <gpgmepp/verificationresult.h>
00044 #include <gpgmepp/data.h>
00045
00046 #include <assert.h>
00047
00048 Kleo::QGpgMEVerifyDetachedJob::QGpgMEVerifyDetachedJob( GpgME::Context * context )
00049 : VerifyDetachedJob( QGpgME::EventLoopInteractor::instance(), "Kleo::QGpgMEVerifyDetachedJob" ),
00050 QGpgMEJob( this, context )
00051 {
00052 assert( context );
00053 }
00054
00055 Kleo::QGpgMEVerifyDetachedJob::~QGpgMEVerifyDetachedJob() {
00056 }
00057
00058 void Kleo::QGpgMEVerifyDetachedJob::setup( const QByteArray & signature, const QByteArray & signedData ) {
00059 assert( !mInData );
00060 assert( !mOutData );
00061
00062 createInData( signature );
00063
00064
00065 mOutDataDataProvider = new QGpgME::QByteArrayDataProvider( signedData );
00066 mOutData = new GpgME::Data( mOutDataDataProvider );
00067 assert( !mOutData->isNull() );
00068 }
00069
00070 GpgME::Error Kleo::QGpgMEVerifyDetachedJob::start( const QByteArray & signature,
00071 const QByteArray & signedData ) {
00072 setup( signature, signedData );
00073
00074 hookupContextToEventLoopInteractor();
00075
00076 const GpgME::Error err = mCtx->startDetachedSignatureVerification( *mInData, *mOutData );
00077
00078 if ( err )
00079 deleteLater();
00080 return err;
00081 }
00082
00083 GpgME::VerificationResult Kleo::QGpgMEVerifyDetachedJob::exec( const QByteArray & signature,
00084 const QByteArray & signedData ) {
00085 setup( signature, signedData );
00086 return mCtx->verifyDetachedSignature( *mInData, *mOutData );
00087 }
00088
00089 void Kleo::QGpgMEVerifyDetachedJob::doOperationDoneEvent( const GpgME::Error & ) {
00090 emit result( mCtx->verificationResult() );
00091 }
00092
00093
00094 #include "qgpgmeverifydetachedjob.moc"
|