コード例 #1
0
        public SignerInfo(
            ASN1Sequence seq)
        {
            IEnumerator e = seq.getObjects();

            e.MoveNext();
            version = (DERInteger)e.Current;
            e.MoveNext();
            sid = SignerIdentifier.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;
            }
        }
コード例 #2
0
        public SignerInfo(
            SignerIdentifier sid,
            AlgorithmIdentifier digAlgorithm,
            ASN1Set authenticatedAttributes,
            AlgorithmIdentifier digEncryptionAlgorithm,
            ASN1OctetString encryptedDigest,
            ASN1Set unauthenticatedAttributes)
        {
            if (sid.isTagged())
            {
                this.version = new DERInteger(3);
            }
            else
            {
                this.version = new DERInteger(1);
            }

            this.sid                       = sid;
            this.digAlgorithm              = digAlgorithm;
            this.authenticatedAttributes   = authenticatedAttributes;
            this.digEncryptionAlgorithm    = digEncryptionAlgorithm;
            this.encryptedDigest           = encryptedDigest;
            this.unauthenticatedAttributes = unauthenticatedAttributes;
        }