KeyRingReport: New infoVerify callback showing the trusted key that will be used
authorMichael Andres <ma@suse.de>
Thu, 8 May 2014 16:53:50 +0000 (18:53 +0200)
committerMichael Andres <ma@suse.de>
Thu, 8 May 2014 16:53:50 +0000 (18:53 +0200)
zypp/KeyRing.cc
zypp/KeyRing.h

index cb4c719..50b8d8d 100644 (file)
@@ -59,6 +59,9 @@ namespace zypp
     _keyRingDefaultAccept = value_r;
   }
 
+  void KeyRingReport::infoVerify( const std::string & file_r, const PublicKeyData & keyData_r, const KeyContext & keycontext )
+  {}
+
   bool KeyRingReport::askUserToAcceptUnsignedFile( const std::string & file, const KeyContext & keycontext )
   { return _keyRingDefaultAccept.testFlag( KeyRing::ACCEPT_UNSIGNED_FILE ); }
 
@@ -402,13 +405,15 @@ namespace zypp
        }
       }
 
+      if ( ! trustedKeyData )  // invalidated by previous import
+       trustedKeyData = publicKeyExists( id, trustedKeyRing() );
+      report->infoVerify( filedesc, trustedKeyData, context );
+
       // it exists, is trusted, does it validates?
       if ( verifyFile( file, signature, trustedKeyRing() ) )
         return true;
       else
       {
-       if ( ! trustedKeyData ) // invalidated by previous import
-         trustedKeyData = publicKeyExists( id, trustedKeyRing() );
         return report->askUserToAcceptVerificationFailed( filedesc, exportKey( trustedKeyData, trustedKeyRing() ), context );
       }
     }
index 090ca5d..f193ad6 100644 (file)
@@ -76,6 +76,9 @@ namespace zypp
      */
     virtual KeyTrust askUserToAcceptKey( const PublicKey &key, const KeyContext &keycontext = KeyContext() );
 
+    /** Informal callback showing the trusted key that will be used for verification. */
+    virtual void infoVerify( const std::string & file_r, const PublicKeyData & keyData_r, const KeyContext &keycontext = KeyContext() );
+
     virtual bool askUserToAcceptUnsignedFile( const std::string &file, const KeyContext &keycontext = KeyContext() );
 
     /**