summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth/Messaging/MessageProtections.cs
blob: e3633f0e73895c7d014bf6565246f5670eb14622 (plain)
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
//-----------------------------------------------------------------------
// <copyright file="MessageProtections.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Messaging {
	using System;

	/// <summary>
	/// Categorizes the various types of channel binding elements so they can be properly ordered.
	/// </summary>
	/// <remarks>
	/// The order of these enum values is significant.  
	/// Each successive value requires the protection offered by all the previous values
	/// in order to be reliable.  For example, message expiration is meaningless without
	/// tamper protection to prevent a user from changing the timestamp on a message.
	/// </remarks>
	[Flags]
	public enum MessageProtections {
		/// <summary>
		/// No protection.
		/// </summary>
		None = 0x0,

		/// <summary>
		/// A binding element that signs a message before sending and validates its signature upon receiving.
		/// </summary>
		TamperProtection = 0x1,

		/// <summary>
		/// A binding element that enforces a maximum message age between sending and processing on the receiving side.
		/// </summary>
		Expiration = 0x2,

		/// <summary>
		/// A binding element that prepares messages for replay detection and detects replayed messages on the receiving side.
		/// </summary>
		ReplayProtection = 0x4,

		/// <summary>
		/// All forms of protection together.
		/// </summary>
		All = TamperProtection | Expiration | ReplayProtection,
	}

#if SILVERLIGHT
	/// <summary>
	/// Indicates the security services requested for an authenticated stream.
	/// </summary>
	public enum ProtectionLevel {
		/// <summary>
		/// No protection required.
		/// </summary>
		None,

		/// <summary>
		/// Message (part) should be signed.
		/// </summary>
		Sign,

		/// <summary>
		/// Message (part) should be encrypted and signed.
		/// </summary>
		EncryptAndSign,
	}
#endif
}