/// <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()); }
Byte[] encodeCTL() { var builder = new Asn1Builder() .AddDerData(new X509EnhancedKeyUsageExtension(SubjectUsages, false).RawData); var rawData = new List <Byte>(new X509EnhancedKeyUsageExtension(SubjectUsages, false).RawData); if (!String.IsNullOrEmpty(ListIdentifier)) { builder.AddOctetString(Encoding.Unicode.GetBytes(ListIdentifier + "\0")); } if (SequenceNumber != null) { builder.AddInteger(SequenceNumber.Value); } builder.AddDerData(Asn1Utils.EncodeDateTime(ThisUpdate.ToUniversalTime())); if (NextUpdate != null) { builder.AddDerData(Asn1Utils.EncodeDateTime(NextUpdate.Value.ToUniversalTime())); } return(builder.AddDerData(new AlgorithmIdentifier(HashAlgorithm, new Byte[0]).RawData) .AddDerData(Entries.Encode()) .GetRawData()); }