Пример #1
0
 public Asn1Tagged(Asn1Decoder dec, System.IO.Stream in_Renamed, int len, Asn1Identifier identifier) : base(identifier)
 {
     // If we are decoding an implicit tag, there is no way to know at this
     // low level what the base type really is. We can place the content
     // into an Asn1OctetString type and pass it back to the application who
     // will be able to create the appropriate ASN.1 type for this tag.
     content = new Asn1OctetString(dec, in_Renamed, len);
     return;
 }
Пример #2
0
        public override String ToString()
        {
            String[] classTypes = new String[] { "[UNIVERSAL ", "[APPLICATION ", "[", "[PRIVATE " };

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            Asn1Identifier            id = getIdentifier();  // could be overridden.

            sb.Append(classTypes[id.Asn1Class]).Append(id.Tag).Append("] ");

            return(sb.ToString());
        }
Пример #3
0
        /// <summary> Constructs an Asn1Tagged object.</summary>
        public Asn1Tagged(Asn1Identifier identifier, Asn1Object object_Renamed, bool explicit_Renamed) : base(identifier)
        {
            content = object_Renamed;
            this.explicit_Renamed = explicit_Renamed;

            if (!explicit_Renamed && content != null)
            {
                // replace object's id with new tag.
                content.setIdentifier(identifier);
            }
            return;
        }
Пример #4
0
        /* Encoders for ASN.1 useful types
         */
        /* Encoder for ASN.1 Identifier
         */

        /// <summary> Encode an Asn1Identifier directly into the specified outputstream.</summary>
        public void  encode(Asn1Identifier id, System.IO.Stream out_Renamed)
        {
            int   c   = id.Asn1Class;
            int   t   = id.Tag;
            sbyte ccf = (sbyte)((c << 6) | (id.Constructed?0x20:0));

            if (t < 30)
            {
                /* single octet */
                out_Renamed.WriteByte((Byte)(ccf | t));
            }
            else
            {
                /* multiple octet */
                out_Renamed.WriteByte((Byte)(ccf | 0x1F));
                encodeTagInteger(t, out_Renamed);
            }
            return;
        }
Пример #5
0
 /// <summary> Sets the identifier of the contained Asn1Object. We
 /// override the parent method as the identifier of
 /// an Asn1Choice depends on the type of the object
 /// encoded by this Asn1Choice.
 /// </summary>
 public override void  setIdentifier(Asn1Identifier id)
 {
     content.setIdentifier(id);
     return;
 }
Пример #6
0
 private void  InitBlock()
 {
     asn1ID  = new Asn1Identifier();
     asn1Len = new Asn1Length();
 }
Пример #7
0
 /// <summary> Sets the identifier for this Asn1Object. This is helpful when
 /// creating implicit Asn1Tagged types.
 ///
 /// </summary>
 /// <param name="id">An Asn1Identifier object representing the CLASS,
 /// FORM and TAG)
 /// </param>
 public virtual void  setIdentifier(Asn1Identifier id)
 {
     this.id = id;
     return;
 }
Пример #8
0
 public Asn1Object(Asn1Identifier id)
 {
     this.id = id;
     return;
 }
Пример #9
0
 internal Asn1Numeric(Asn1Identifier id, long value_Renamed) : base(id)
 {
     content = (Int64)value_Renamed;
     return;
 }
Пример #10
0
 /*
  * Create a an Asn1 structured type with default size of 10
  *
  * @param id the Asn1Identifier containing the tag for this structured type
  *
  * @param content an array containing the content
  *
  * @param size the number of items of content in the array
  */
 protected internal Asn1Structured(Asn1Identifier id, Asn1Object[] newContent, int size) : base(id)
 {
     content      = newContent;
     contentIndex = size;
 }
Пример #11
0
 /*
  * Create a an Asn1 structured type with the designated size
  *
  * @param id the Asn1Identifier containing the tag for this structured type
  *
  * @param size the size to allocate
  */
 protected internal Asn1Structured(Asn1Identifier id, int size) : base(id)
 {
     content = new Asn1Object[size];
 }
Пример #12
0
 /*
  * Create a an Asn1 structured type with default size of 10
  *
  * @param the Asn1Identifier containing the tag for this structured type
  */
 protected internal Asn1Structured(Asn1Identifier id) : this(id, 10)
 {
 }
Пример #13
0
        /* Constructors for Asn1Tagged
         */

        /// <summary> Constructs an Asn1Tagged object using the provided
        /// AN1Identifier and the Asn1Object.
        ///
        /// The explicit flag defaults to true as per the spec.
        /// </summary>
        public Asn1Tagged(Asn1Identifier identifier, Asn1Object object_Renamed) : this(identifier, object_Renamed, true)
        {
            return;
        }