Exemplo n.º 1
0
 public AsnElt Encode()
 {
     return(AsnElt.Make(AsnElt.SEQUENCE,
                        new AsnElt[] {
         AsnElt.Make(AsnElt.CONTEXT, 0, Authenticator.Encode()),
         AsnElt.Make(AsnElt.CONTEXT, 1, ClientPublicValue.Encode()),
         //AsnElt.Make(AsnElt.CONTEXT,2, new AsnElt[]{ CMSTypes } ),
         AsnElt.Make(AsnElt.CONTEXT, 3, AsnElt.MakeBlob(ClientDHNonce))
     }));
 }
Exemplo n.º 2
0
        internal void Encode(AsnWriter writer, Asn1Tag tag)
        {
            writer.PushSequence(tag);

            writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 0));
            PKAuthenticator?.Encode(writer);
            writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 0));

            if (Asn1Extension.HasValue(ClientPublicValue))
            {
                writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
                ClientPublicValue?.Encode(writer);
                writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 1));
            }

            if (Asn1Extension.HasValue(SupportedCMSTypes))
            {
                writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
                writer.PushSequence();

                for (int i = 0; i < SupportedCMSTypes.Length; i++)
                {
                    SupportedCMSTypes[i]?.Encode(writer);
                }

                writer.PopSequence();

                writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2));
            }


            if (Asn1Extension.HasValue(ClientDHNonce))
            {
                writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
                writer.WriteOctetString(ClientDHNonce.Value.Span);
                writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 3));
            }
            writer.PopSequence(tag);
        }