Ejemplo n.º 1
0
        internal byte[][] Encode()
        {
            var bytes  = DirectoryName.RawData;
            var reader = DerSequenceReader.CreateForPayload(bytes);

            var tag             = reader.PeekTag();
            var value           = reader.ReadValue((DerSequenceReader.DerTag)tag);
            var lengthByteCount = reader.ContentLength - 1 - value.Length;
            var length          = new byte[lengthByteCount];

            Array.Copy(bytes, sourceIndex: 1, destinationArray: length, destinationIndex: 0, length: length.Length);

            const int contextId = 4;

            return(DerEncoder.ConstructSegmentedContextSpecificValue(
                       contextId,
                       new byte[][]
            {
                new byte[1] {
                    tag
                },
                length,
                value
            }));
        }