-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCloudInterface
61 lines (46 loc) · 1.1 KB
/
CloudInterface
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ICloudConnection
{
byte[] GetKey(); // a global key
byte[] GetIV(); // a global iv, maybe append open to output
ICloud GetInterface(string user, string pass)
}
ICloud
{
string GetDirectory(string path);
bool ValidateSig(byte[] file, byte[] sig);
void CreateDirectory(string path);
void CreateFile(string path, byte[] data);
byte[] ReadFile(string path);
// use copy & delete to update a file
void UpdateFile(string path);
// removes file a loction
void DeleteFile(string path);
// create copy of file to another location
void Copy(string src, string dst);
}
ICrypt
{
byte[] Decrypt(byte[] iv, byte[] key);
void Ecrypt(byte[] iv, byte[] key, byte[] data);
byte[] Hash(byte[] salt, byte[] key, byte[] data); // hash + salt = output
byte[] ValidateHash(byte[] hash, byte[] data); // hash + salt = input(data)
}
ICloudUtility
{
GenerateKey();
GenerateIV();
CreateCloud();
}
// file inteface
Create
Open
Read
Write
Delete
Update , delete & write
// todo
IFile
{
FileStream Open(string path, FileMode mode, FileAccess access);
public override int Read(byte[] array, int offset, int count);
}