Files
esiur-dotnet/Libraries/Esiur/Security/Cryptography/EncryptionContext.cs
T
2026-07-14 17:26:51 +03:00

56 lines
2.2 KiB
C#

using Esiur.Security.Authority;
namespace Esiur.Security.Cryptography;
/// <summary>
/// Authenticated and negotiated material used to create a session cipher.
/// Initiator and responder values always retain their protocol roles, regardless
/// of which peer creates the cipher.
/// </summary>
public sealed class EncryptionContext
{
/// <summary>Shared secret produced by the authentication provider.</summary>
public byte[] Key { get; set; }
/// <summary>Role of the peer creating the cipher.</summary>
public AuthenticationDirection Direction { get; set; }
/// <summary>Negotiated encryption mode.</summary>
public EncryptionMode Mode { get; set; }
/// <summary>Negotiated provider protocol name.</summary>
public string Protocol { get; set; }
/// <summary>
/// Encryption protocols offered by the initiator, in their original wire order.
/// Binding the complete offer prevents an intermediary from silently removing or
/// reordering stronger choices during negotiation.
/// </summary>
public string[] OfferedProtocols { get; set; }
/// <summary>Authentication mode that produced the shared session key.</summary>
public AuthenticationMode AuthenticationMode { get; set; }
/// <summary>Negotiated authentication protocol that produced the shared key.</summary>
public string AuthenticationProtocol { get; set; }
/// <summary>
/// Authentication realm/domain requested by the initiator. This is part of the
/// authenticated encryption transcript so credentials cannot be redirected to a
/// different realm that happens to derive the same shared key.
/// </summary>
public string Domain { get; set; }
/// <summary>Fresh public nonce generated by the session initiator.</summary>
public byte[] InitiatorNonce { get; set; }
/// <summary>Fresh public nonce generated by the session responder.</summary>
public byte[] ResponderNonce { get; set; }
/// <summary>Initiator address used by address-bound encryption mode.</summary>
public byte[] InitiatorAddress { get; set; }
/// <summary>Responder address used by address-bound encryption mode.</summary>
public byte[] ResponderAddress { get; set; }
}