예제 #1
0
        Byte[] encodeSignedData()
        {
            var builder = new Asn1Builder()
                          .AddInteger(Version)
                          .AddDerData(DigestAlgorithms.Encode())
                          .AddDerData(encodeContentInfo());

            // certificates
            if (Certificates.Count > 0)
            {
                builder.AddExplicit(0, Certificates.Encode(), false);
            }
            // CRLs
            if (RevocationLists.Count > 0)
            {
                var crlBytes = new List <Byte>();
                foreach (X509CRL2 crl in RevocationLists)
                {
                    crlBytes.AddRange(crl.RawData);
                }
                builder.AddExplicit(1, crlBytes.ToArray(), false);
            }
            builder.AddDerData(SignerInfos.Encode());
            return(builder.GetEncoded());
        }