Beispiel #1
0
 public override int Run(string[] remainingArguments)
 {
     using (var keySet = new MutableKeySet(_location))
     {
         var status = keySet.Promote(_version);
         if (status == null)
         {
             Console.WriteLine("{0} {1}.", Localized.MsgUnknownVersion, _version);
             return(-1);
         }
         try
         {
             if (keySet.Save(new FileSystemKeySetWriter(_location, overwrite: true)))
             {
                 Console.WriteLine(Localized.MsgPromotedVersion, _version, status);
                 return(0);
             }
         }
         catch
         {
             //error handling unified with falling through - lgtm [cs/empty-catch-block]
         }
         Console.WriteLine("{0} {1}.", Localized.MsgCouldNotWrite, _location);
         return(-1);
     }
 }
Beispiel #2
0
 public override int Run(string[] remainingArguments)
 {
     using (var keySet = new MutableKeySet(_location))
     {
         var status = keySet.Promote(_version);
         if (status == null)
         {
             Console.WriteLine("{0} {1}.", Localized.MsgUnknownVersion, _version);
             return(-1);
         }
         try
         {
             if (keySet.Save(new KeySetWriter(_location, overwrite: true)))
             {
                 Console.WriteLine(Localized.MsgPromotedVersion, _version, status);
                 return(0);
             }
         }
         catch
         {
         }
         Console.WriteLine("{0} {1}.", Localized.MsgCouldNotWrite, _location);
         return(-1);
     }
 }
Beispiel #3
0
 public void TestPromotePrimary()
 {
     using (var reader = new MutableKeySet(Util.TestDataPath(TEST_DATA, "aes-noprimary"))){
         var status = reader.Promote(1);
         Expect(status, Is.EqualTo(KeyStatus.Primary));
         Expect(() => new GetPrimary(reader).GetPrimaryExposed(), Is.Not.Null);
     }
 }