Example #1
0
 private void DoWork()
 {
     Alias.AddSecret(Id, Input, Overwrite);
     Alias.Commit();
     Console.WriteLine($"Secret {Id.InQuotes()} added to {nameof(X509Alias)} {Alias.Name.InQuotes()} in the {Alias.Context.Name} {nameof(X509Context)}");
     Result = true;
 }
Example #2
0
        private void DoWork()
        {
            X509Context OldContext,
                        NewContext;

            OldContext = Alias.Context;
            if (contextSet)
            {
                NewContext = X509Context.Select(Location, false);
            }
            else
            {
                NewContext = Alias.Context;
            }

            if (!X509CryptoAgent.CertificateExists(Thumbprint, NewContext))
            {
                throw new X509CryptoCertificateNotFoundException(Thumbprint, NewContext);
            }
            Alias.ReEncrypt(Thumbprint, NewContext);
            Alias.Commit();
            Console.WriteLine($"{nameof(X509Alias)} {Alias.Name} successfully updated. Now using encryption certificate with thumbprint {Thumbprint} from the {NewContext.Name} {nameof(X509Context)}");
        }