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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
namespace Devolutions.Cryptography
{
using System;
/// <summary>
/// Devolutions Crypto Data Type.
/// </summary>
public enum DataType
{
/// <summary>
/// Key
/// </summary>
Key = 1,
/// <summary>
/// Cipher
/// </summary>
Cipher = 2,
/// <summary>
/// Password Hash
/// </summary>
PasswordHash = 3,
/// <summary>
/// Password Hash
/// </summary>
[Obsolete("This value has been deprecated. Use DataType.PasswordHash instead.")]
Hash = 3,
/// <summary>
/// A wrapped share. Used for secret sharing scheme.
/// </summary>
Share = 4,
/// <summary>
/// A wrapped key used to sign data.
/// </summary>
SigningKey = 5,
/// <summary>
/// A wrapped signature
/// </summary>
Signature = 6,
/// <summary>
/// TODO
/// </summary>
OnlineCiphertext = 7
}
/// <summary>
/// Devolutions Crypto Cipher Version.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "V2_5 is not version 25")]
public enum CipherTextVersion
{
/// <summary>
/// This is the latest version. (Currently XChaCha20Poly1305)
/// </summary>
Latest = 0,
/// <summary>
/// Aes256CbcHmacSha256
/// </summary>
V1 = 1,
/// <summary>
/// XChaCha20Poly1305
/// </summary>
V2 = 2,
/// <summary>
/// XChaCha20Poly1305 with DeriveKey length fix
/// </summary>
V2_5 = 2,
}
/// <summary>
/// Devolutions Crypto Signature Version.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "V2_5 is not version 25")]
public enum SignatureVersion
{
/// <summary>
/// This is the latest version. (Currently ed25519)
/// </summary>
Latest = 0,
/// <summary>
/// ed25519
/// </summary>
V1 = 1,
}
/// <summary>
/// Enum containing the different error codes on the managed side.
/// </summary>
public enum ManagedError
{
/// <summary>
/// Error when an invalid parameter was received. (Ex: Null Encryption Key)
/// </summary>
InvalidParameter,
/// <summary>
/// Error when the devolutions crypto native library version doesn't match the managed version.
/// </summary>
IncompatibleVersion,
/// <summary>
/// Error when the native library cannot be loaded
/// </summery>
NativeLibraryLoad,
/// <summary>
/// Error when the stream cannot be seek.
/// </summary>
CanNotSeekStream,
/// <summary>
/// Error when the stream cannot be read.
/// </summary>
CanNotReadStream,
/// <summary>
/// Unknown error.
/// </summary>
Error,
}
}