Ejemplo n.º 1
0
        private DigestInfo(
            Asn1Sequence seq)
        {
            if (seq.Count != 2)
            {
                throw new ArgumentException("Wrong number of elements in sequence", "seq");
            }

            algID  = AlgorithmIdentifier.GetInstance(seq[0]);
            digest = Asn1OctetString.GetInstance(seq[1]).GetOctets();
        }
Ejemplo n.º 2
0
        private SubjectPublicKeyInfo(
            Asn1Sequence seq)
        {
            if (seq.Count != 2)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
            }

            this.algID   = AlgorithmIdentifier.GetInstance(seq[0]);
            this.keyData = DerBitString.GetInstance(seq[1]);
        }
Ejemplo n.º 3
0
        private CertificateList(
            Asn1Sequence seq)
        {
            if (seq.Count != 3)
            {
                throw new ArgumentException("sequence wrong size for CertificateList", "seq");
            }

            tbsCertList = TbsCertificateList.GetInstance(seq[0]);
            sigAlgID    = AlgorithmIdentifier.GetInstance(seq[1]);
            sig         = DerBitString.GetInstance(seq[2]);
        }
Ejemplo n.º 4
0
        private AttributeCertificate(
            Asn1Sequence seq)
        {
            if (seq.Count != 3)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }

            this.acinfo             = AttributeCertificateInfo.GetInstance(seq[0]);
            this.signatureAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
            this.signatureValue     = DerBitString.GetInstance(seq[2]);
        }
Ejemplo n.º 5
0
        private X509CertificateStructure(
            Asn1Sequence seq)
        {
            if (seq.Count != 3)
            {
                throw new ArgumentException("sequence wrong size for a certificate", "seq");
            }

            //
            // correct x509 certficate
            //
            tbsCert  = TbsCertificateStructure.GetInstance(seq[0]);
            sigAlgID = AlgorithmIdentifier.GetInstance(seq[1]);
            sig      = DerBitString.GetInstance(seq[2]);
        }
Ejemplo n.º 6
0
        internal TbsCertificateList(
            Asn1Sequence seq)
        {
            if (seq.Count < 3 || seq.Count > 7)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }

            int seqPos = 0;

            this.seq = seq;

            if (seq[seqPos] is DerInteger)
            {
                version = DerInteger.GetInstance(seq[seqPos++]);
            }
            else
            {
                version = new DerInteger(0);
            }

            signature  = AlgorithmIdentifier.GetInstance(seq[seqPos++]);
            issuer     = X509Name.GetInstance(seq[seqPos++]);
            thisUpdate = Time.GetInstance(seq[seqPos++]);

            if (seqPos < seq.Count &&
                (seq[seqPos] is DerUtcTime ||
                 seq[seqPos] is DerGeneralizedTime ||
                 seq[seqPos] is Time))
            {
                nextUpdate = Time.GetInstance(seq[seqPos++]);
            }

            if (seqPos < seq.Count &&
                !(seq[seqPos] is DerTaggedObject))
            {
                revokedCertificates = Asn1Sequence.GetInstance(seq[seqPos++]);
            }

            if (seqPos < seq.Count &&
                seq[seqPos] is DerTaggedObject)
            {
                crlExtensions = X509Extensions.GetInstance(seq[seqPos]);
            }
        }
Ejemplo n.º 7
0
        private ObjectDigestInfo(
            Asn1Sequence seq)
        {
            if (seq.Count > 4 || seq.Count < 3)
            {
                throw new ArgumentException("Bad sequence size: " + seq.Count);
            }

            digestedObjectType = DerEnumerated.GetInstance(seq[0]);

            int offset = 0;

            if (seq.Count == 4)
            {
                otherObjectTypeID = DerObjectIdentifier.GetInstance(seq[1]);
                offset++;
            }

            digestAlgorithm = AlgorithmIdentifier.GetInstance(seq[1 + offset]);
            objectDigest    = DerBitString.GetInstance(seq[2 + offset]);
        }