Esempio n. 1
0
        private static void HandleDecrypt()
        {
            var key = ReadKey();

            var EncryptedByteJson = File.ReadAllBytes(STORAGE_PATH);
            var byteJson          = Securer.VisinerTransform(EncryptedByteJson, key, WorkMode.DECRYPT);
            var json = Encoding.Default.GetString(byteJson);

            var filesStorage = JsonSerializer.Deserialize <FilesStorage>(json);

            filesStorage.RestoreCatalog();
        }
Esempio n. 2
0
        private static void HandleEncrypt()
        {
            var path         = ReadPath();
            var key          = ReadKey();
            var filesStorage = FilesStorage.CreateByCatalogName(path);

            var json              = JsonSerializer.Serialize(filesStorage);
            var byteJson          = Encoding.Default.GetBytes(json);
            var EncryptedByteJson = Securer.VisinerTransform(byteJson, key, WorkMode.ENCRYPT);

            File.WriteAllBytesAsync(STORAGE_PATH, EncryptedByteJson);
            filesStorage.DeleteCatalog();
        }