using Esiur.Security.Authority; namespace Esiur.Security.Cryptography; /// /// 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. /// public sealed class EncryptionContext { /// Shared secret produced by the authentication provider. public byte[] Key { get; set; } /// Role of the peer creating the cipher. public AuthenticationDirection Direction { get; set; } /// Negotiated encryption mode. public EncryptionMode Mode { get; set; } /// Negotiated provider protocol name. public string Protocol { get; set; } /// /// 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. /// public string[] OfferedProtocols { get; set; } /// Authentication mode that produced the shared session key. public AuthenticationMode AuthenticationMode { get; set; } /// Negotiated authentication protocol that produced the shared key. public string AuthenticationProtocol { get; set; } /// /// 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. /// public string Domain { get; set; } /// Fresh public nonce generated by the session initiator. public byte[] InitiatorNonce { get; set; } /// Fresh public nonce generated by the session responder. public byte[] ResponderNonce { get; set; } /// Initiator address used by address-bound encryption mode. public byte[] InitiatorAddress { get; set; } /// Responder address used by address-bound encryption mode. public byte[] ResponderAddress { get; set; } }