/// <inheritdoc /> public override Byte[] Encode() { var builder = new Asn1Builder() .AddInteger(Version) .AddDerData(RequestMessage.Encode()); if (PolicyID != null) { builder.AddObjectIdentifier(PolicyID); } if (UseNonce) { nonce = Guid.NewGuid().ToByteArray(); builder.AddInteger(new BigInteger(nonce)); } else { nonce = default; } if (RequestCertificates) { builder.AddBoolean(RequestCertificates); } if (_extensions.Any()) { builder.AddExplicit(0, Extensions.Encode(), false); } return(builder.GetEncoded()); }
public void Encode() { Message.Encode(Buffer.Span); }
public MessageEncoder() { Message = new RequestMessage(1, 2, 3); Buffer = new Memory <byte> (new byte[20]); Message.Encode(Buffer.Span); }