summary refs log tree commit diff
path: root/crypto/src/asn1/DLExternal.cs
blob: ac31495cc835f5713d33f0b43eb11545cd307370 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
namespace Org.BouncyCastle.Asn1
{
    public class DLExternal
        : DerExternal
    {
        public DLExternal(Asn1EncodableVector vector)
            : base(vector)
        {
        }

        public DLExternal(Asn1Sequence sequence)
            : base(sequence)
        {
        }

        public DLExternal(DerObjectIdentifier directReference, DerInteger indirectReference,
            Asn1ObjectDescriptor dataValueDescriptor, Asn1TaggedObject externalData)
            : base(directReference, indirectReference, dataValueDescriptor, externalData)
        {
        }

        public DLExternal(DerObjectIdentifier directReference, DerInteger indirectReference,
            Asn1ObjectDescriptor dataValueDescriptor, int encoding, Asn1Object externalData)
            : base(directReference, indirectReference, dataValueDescriptor, encoding, externalData)
        {
        }

        internal override Asn1Sequence BuildSequence()
        {
            Asn1EncodableVector v = new Asn1EncodableVector(4);
            v.AddOptional(directReference, indirectReference, dataValueDescriptor);
            v.Add(new DLTaggedObject(0 == encoding, encoding, externalContent));
            return new DLSequence(v);
        }

        internal override IAsn1Encoding GetEncodingImplicit(int encoding, int tagClass, int tagNo)
        {
            if (Asn1OutputStream.EncodingDer == encoding)
                return base.GetEncodingImplicit(encoding, tagClass, tagNo);

            return BuildSequence().GetEncodingImplicit(Asn1OutputStream.EncodingDL, tagClass, tagNo);
        }
    }
}