Beispiel #1
0
        public override async Task <int> Write(IAsn1Serializer asn1Serializer, Asn1OctetString item, Stream stream, CancellationToken cancellationToken)
        {
            var identBytes = await SerializerUtility.WriteIdentifier(item.Id, stream, cancellationToken);

            var lenBytes = await SerializerUtility.WriteLength(item.Data.Length, stream, cancellationToken);

            await stream.WriteBERBytes(item.Data, cancellationToken : cancellationToken);

            return(identBytes + lenBytes + item.Data.Length);
        }
        public override async Task <int> Write(IAsn1Serializer asn1Serializer, Asn1Set item, Stream stream, CancellationToken cancellationToken)
        {
            var(ms, setItemBytes) =
                await SerializerUtility.WriteItemsToBufferedStream(asn1Serializer, item.Items, cancellationToken);

            var identBytes = await SerializerUtility.WriteIdentifier(item.Id, stream, cancellationToken);

            var lenBytes = await SerializerUtility.WriteLength(setItemBytes, stream, cancellationToken);

            await ms.CopyToAsync(stream, cancellationToken);

            return(identBytes + lenBytes + setItemBytes);
        }