public void ListForKey()
        {
            var trust = new TrustDB()
                        .TrustKey("abc", new("example.com"))
                        .TrustKey("abc", new("example2.com"));

            trust.Save(TrustDB.DefaultLocation);

            RunAndAssert(trust.Keys[0].Domains, ExitCode.OK, "abc");
        }
Beispiel #2
0
 /// <summary>
 /// Handles new keys that have not been trusted yet.
 /// </summary>
 /// <param name="uri">The URI the signed file originally came from.</param>
 /// <param name="fingerprint">The fingerprint of the key to trust.</param>
 /// <param name="domain">The domain to trust the key for.</param>
 /// <returns><c>true</c> if the user decided to trust the key, <c>false</c> if they decided not to trust the key.</returns>
 /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
 private bool HandleNewKey([NotNull] FeedUri uri, [NotNull] string fingerprint, Domain domain)
 {
     if (AskKeyApproval(uri, fingerprint, domain))
     {
         _trustDB.TrustKey(fingerprint, domain);
         _trustDB.Save();
         return(true);
     }
     else
     {
         return(false);
     }
 }
 private bool TrustNew(TrustDB trustDB, FeedUri uri, ValidSignature signature, Domain domain)
 {
     if (AskKeyApproval(uri, signature, domain))
     {
         trustDB.TrustKey(signature.Fingerprint, domain);
         trustDB.Save();
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Handles new keys that have not been trusted yet.
 /// </summary>
 /// <param name="uri">The URI the signed file originally came from.</param>
 /// <param name="fingerprint">The fingerprint of the key to trust.</param>
 /// <param name="domain">The domain to trust the key for.</param>
 /// <returns><c>true</c> if the user decided to trust the key, <c>false</c> if they decided not to trust the key.</returns>
 /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
 private bool HandleNewKey(FeedUri uri, string fingerprint, Domain domain)
 {
     if (AskKeyApproval(uri, fingerprint, domain))
     {
         _trustDB.TrustKey(fingerprint, domain);
         try
         {
             _trustDB.Save();
         }
         #region Error handling
         catch (Exception ex)
         {
             Log.Error(ex);
         }
         #endregion
         return(true);
     }
     else
     {
         return(false);
     }
 }