Beispiel #1
0
        private KeyModel GetKey()
        {
            string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.key");

            if (files.Length == 0)
            {
                throw new FileNotFoundException("Key file not found! Unable to authorize.");
            }

            string keyFile = files[0];
            string login   = Path.GetFileNameWithoutExtension(keyFile);

            DataProtectionClient client = new DataProtectionClient(Encoding.UTF8.GetBytes(login + login + login));

            return(JsonConvert.DeserializeObject <KeyModel>(client.AsString(client.Unprotect(File.ReadAllBytes(keyFile)))));
        }
Beispiel #2
0
 public void Initialize(MockContext context)
 {
     BackupClient = context.GetServiceClient <DataProtectionClient>();
 }