certmanager/lib
qgpgmeverifyopaquejob.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 "qgpgmeverifyopaquejob.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::QGpgMEVerifyOpaqueJob::QGpgMEVerifyOpaqueJob( GpgME::Context * context )
00049 : VerifyOpaqueJob( QGpgME::EventLoopInteractor::instance(), "Kleo::QGpgMEVerifyOpaqueJob" ),
00050 QGpgMEJob( this, context )
00051 {
00052 assert( context );
00053 }
00054
00055 Kleo::QGpgMEVerifyOpaqueJob::~QGpgMEVerifyOpaqueJob() {
00056 }
00057
00058 void Kleo::QGpgMEVerifyOpaqueJob::setup( const QByteArray & signedData ) {
00059 assert( !mInData );
00060 assert( !mOutData );
00061
00062 createInData( signedData );
00063 createOutData();
00064 }
00065
00066 GpgME::Error Kleo::QGpgMEVerifyOpaqueJob::start( const QByteArray & signedData ) {
00067 setup( signedData );
00068
00069 hookupContextToEventLoopInteractor();
00070
00071 const GpgME::Error err = mCtx->startOpaqueSignatureVerification( *mInData, *mOutData );
00072
00073 if ( err )
00074 deleteLater();
00075 return err;
00076 }
00077
00078 GpgME::VerificationResult Kleo::QGpgMEVerifyOpaqueJob::exec( const QByteArray & signedData, QByteArray & plainText ) {
00079 setup( signedData );
00080 const GpgME::VerificationResult res = mCtx->verifyOpaqueSignature( *mInData, *mOutData );
00081 plainText = mOutDataDataProvider->data();
00082 getAuditLog();
00083 return res;
00084 }
00085
00086 void Kleo::QGpgMEVerifyOpaqueJob::doOperationDoneEvent( const GpgME::Error & ) {
00087 const GpgME::VerificationResult res = mCtx->verificationResult();
00088 const QByteArray plainText = mOutDataDataProvider->data();
00089 getAuditLog();
00090 emit result( res, plainText );
00091 }
00092
00093
00094 #include "qgpgmeverifyopaquejob.moc"
|