コード例 #1
0
        private LdsSecurityObject(
            Asn1Sequence seq)
        {
            if (seq == null || seq.Count == 0)
                throw new ArgumentException("null or empty sequence passed.");

            IEnumerator e = seq.GetEnumerator();

            // version
            e.MoveNext();
            version = DerInteger.GetInstance(e.Current);
            // digestAlgorithmIdentifier
            e.MoveNext();
            digestAlgorithmIdentifier = AlgorithmIdentifier.GetInstance(e.Current);

            e.MoveNext();
            Asn1Sequence datagroupHashSeq = Asn1Sequence.GetInstance(e.Current);

            if (version.Value.Equals(BigInteger.One))
            {
                e.MoveNext();
                versionInfo = LdsVersionInfo.GetInstance(e.Current);
            }

            CheckDatagroupHashSeqSize(datagroupHashSeq.Count);

            datagroupHash = new DataGroupHash[datagroupHashSeq.Count];
            for (int i= 0; i< datagroupHashSeq.Count; i++)
            {
                datagroupHash[i] = DataGroupHash.GetInstance(datagroupHashSeq[i]);
            }
        }
コード例 #2
0
        public DHParameter(
            Asn1Sequence seq)
        {
            IEnumerator e = seq.GetEnumerator();

            e.MoveNext();
            p = (DerInteger)e.Current;

            e.MoveNext();
            g = (DerInteger)e.Current;

            if (e.MoveNext())
            {
                l = (DerInteger) e.Current;
            }
        }
コード例 #3
0
        private SignedData(
            Asn1Sequence seq)
        {
            IEnumerator e = seq.GetEnumerator();

            e.MoveNext();
            version = (DerInteger)e.Current;

            e.MoveNext();
            digestAlgorithms = ((Asn1Set)e.Current);

            e.MoveNext();
            contentInfo = ContentInfo.GetInstance(e.Current);

            while (e.MoveNext())
            {
                Asn1Object o = (Asn1Object)e.Current;

                //
                // an interesting feature of SignedData is that there appear
                // to be varying implementations...
                // for the moment we ignore anything which doesn't fit.
                //
                if (o is Asn1TaggedObject)
                {
                    Asn1TaggedObject tagged = (Asn1TaggedObject)o;

                    switch (tagged.TagNo)
                    {
                        case 0:
                            certsBer = tagged is BerTaggedObject;
                            certificates = Asn1Set.GetInstance(tagged, false);
                            break;
                        case 1:
                            crlsBer = tagged is BerTaggedObject;
                            crls = Asn1Set.GetInstance(tagged, false);
                            break;
                        default:
                            throw new ArgumentException("unknown tag value " + tagged.TagNo);
                    }
                }
                else
                {
                    signerInfos = (Asn1Set) o;
                }
            }
        }
コード例 #4
0
        public SignerInfo(
            Asn1Sequence seq)
        {
            IEnumerator e = seq.GetEnumerator();

            e.MoveNext();
            version = (DerInteger) e.Current;

            e.MoveNext();
            issuerAndSerialNumber = IssuerAndSerialNumber.GetInstance(e.Current);

            e.MoveNext();
            digAlgorithm = AlgorithmIdentifier.GetInstance(e.Current);

            e.MoveNext();
            object obj = e.Current;

            if (obj is Asn1TaggedObject)
            {
                authenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject) obj, false);

                e.MoveNext();
                digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(e.Current);
            }
            else
            {
                authenticatedAttributes = null;
                digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(obj);
            }

            e.MoveNext();
            encryptedDigest = DerOctetString.GetInstance(e.Current);

            if (e.MoveNext())
            {
                unauthenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject)e.Current, false);
            }
            else
            {
                unauthenticatedAttributes = null;
            }
        }