using System.Diagnostics.CodeAnalysis; namespace DodoSSH.Crypto; /// /// A parsed view over an envelope's bytes. /// /// /// Holds no copies, so it must not outlive the buffer it was parsed from. Produced by /// . /// [SuppressMessage( "Performance", "CA1815:Override equals and object equals operator", Justification = "A ref struct over borrowed spans; equality is meaningless and cannot be expressed.")] public readonly ref struct DshEnvelopeView { internal DshEnvelopeView( CryptoSpec.AlgorithmId algorithm, ReadOnlySpan ephemeralPublicKey, ReadOnlySpan nonce, ReadOnlySpan ciphertext) { Algorithm = algorithm; EphemeralPublicKey = ephemeralPublicKey; Nonce = nonce; Ciphertext = ciphertext; } /// Construction the envelope declares. public CryptoSpec.AlgorithmId Algorithm { get; } /// Ephemeral X25519 public key, empty unless the algorithm carries one. public ReadOnlySpan EphemeralPublicKey { get; } /// Nonce. public ReadOnlySpan Nonce { get; } /// Ciphertext, including its trailing authentication tag. public ReadOnlySpan Ciphertext { get; } }