Example #1
0
GpgME::Error Kleo::QGpgMEKeyListJob::start( const QStringList & pats, bool secretOnly ) {
  setup( pats, secretOnly );

  hookupContextToEventLoopInteractor();
  connect( QGpgME::EventLoopInteractor::instance(),
	   SIGNAL(nextKeyEventSignal(GpgME::Context*,const GpgME::Key&)),
	   SLOT(slotNextKeyEvent(GpgME::Context*,const GpgME::Key&)) );

  // The communication channel between gpgme and gpgsm is limited in
  // the number of patterns that can be transported, but they won't
  // say to how much, so we need to find out ourselves if we get a
  // LINE_TOO_LONG error back...

  // We could of course just feed them single patterns, and that would
  // probably be easier, but the performance penalty would currently
  // be noticable.

  while ( const GpgME::Error err = mCtx->startKeyListing( patterns(), mSecretOnly ) ) {
    if ( err.code() == GPG_ERR_LINE_TOO_LONG ) {
      setChunkSize( chunkSize()/2 );
      if ( chunkSize() >= 1 ) {
	kdDebug(5150) << "QGpgMEKeyListJob::start(): retrying keylisting with chunksize " << chunkSize() << endl;
	continue;
      }
    }
    deleteLater();
    mResult = GpgME::KeyListResult( 0, err );
    return err;
  }
  mResult = GpgME::KeyListResult( 0, 0 );
  return 0;
}
Example #2
0
GpgME::Error Kleo::QGpgMEVerifyOpaqueJob::start( const QByteArray & signedData ) {
  setup( signedData );

  hookupContextToEventLoopInteractor();

  const GpgME::Error err = mCtx->startOpaqueSignatureVerification( *mInData, *mOutData );
						  
  if ( err )
    deleteLater();
  return err;
}
Example #3
0
GpgME::Error Kleo::QGpgMEExportJob::start( const QStringList & pats ) {
  assert( !patterns() );
  assert( !mOutData );

  createOutData();
  setPatterns( pats );
  hookupContextToEventLoopInteractor();

  const GpgME::Error err = mCtx->startPublicKeyExport( patterns(), *mOutData );
						  
  if ( err )
    deleteLater();
  return err;
}
Example #4
0
GpgME::Error Kleo::QGpgMEEncryptJob::start( const std::vector<GpgME::Key> & recipients,
					    const QByteArray & plainText, bool alwaysTrust ) {
  setup( plainText );

  hookupContextToEventLoopInteractor();

  const GpgME::Context::EncryptionFlags flags =
    alwaysTrust ? GpgME::Context::AlwaysTrust : GpgME::Context::None;
  const GpgME::Error err = mCtx->startEncryption( recipients, *mInData, *mOutData, flags );
						  
  if ( err )
    deleteLater();
  mResult = GpgME::EncryptionResult( err );
  return err;
}