コード例 #1
0
        /**
         * Return the first SignerInformation object that matches the
         * passed in selector. Null if there are no matches.
         *
         * @param selector to identify a signer
         * @return a single SignerInformation object. Null if none matches.
         */
        public SignerInformation GetFirstSigner(
            SignerID selector)
        {
            IList list = (IList)table[selector];

            return(list == null ? null : (SignerInformation)list[0]);
        }
コード例 #2
0
        /**
         * Return possible empty collection with signers matching the passed in SignerID
         *
         * @param selector a signer id to select against.
         * @return a collection of SignerInformation objects.
         */
        public ICollection GetSigners(
            SignerID selector)
        {
            IList list = (IList)table[selector];

            return(list == null?Platform.CreateArrayList() : Platform.CreateArrayList(list));
        }
コード例 #3
0
        private readonly IDictionary table = Platform.CreateHashtable(); // Hashtable[SignerID, ArrayList[SignerInformation]]

        public SignerInformationStore(
            ICollection signerInfos)
        {
            foreach (SignerInformation signer in signerInfos)
            {
                SignerID sid  = signer.SignerID;
                IList    list = (IList)table[sid];

                if (list == null)
                {
                    table[sid] = list = Platform.CreateArrayList(1);
                }

                list.Add(signer);
            }

            this.all = Platform.CreateArrayList(signerInfos);
        }
コード例 #4
0
        internal SignerInformation(
            SignerInfo info,
            DerObjectIdentifier contentType,
            CmsProcessable content,
            IDigestCalculator digestCalculator)
        {
            this.info               = info;
            this.sid                = new SignerID();
            this.contentType        = contentType;
            this.isCounterSignature = contentType == null;

            try
            {
                SignerIdentifier s = info.SignerID;

                if (s.IsTagged)
                {
                    Asn1OctetString octs = Asn1OctetString.GetInstance(s.ID);

                    sid.SubjectKeyIdentifier = octs.GetEncoded();
                }
                else
                {
                    Asn1.Cms.IssuerAndSerialNumber iAnds =
                        Asn1.Cms.IssuerAndSerialNumber.GetInstance(s.ID);

                    sid.Issuer       = iAnds.Name;
                    sid.SerialNumber = iAnds.SerialNumber.Value;
                }
            }
            catch (IOException)
            {
                throw new ArgumentException("invalid sid in SignerInfo");
            }

            this.digestAlgorithm      = info.DigestAlgorithm;
            this.signedAttributeSet   = info.AuthenticatedAttributes;
            this.unsignedAttributeSet = info.UnauthenticatedAttributes;
            this.encryptionAlgorithm  = info.DigestEncryptionAlgorithm;
            this.signature            = info.EncryptedDigest.GetOctets();

            this.content          = content;
            this.digestCalculator = digestCalculator;
        }
コード例 #5
0
ファイル: SignerId.cs プロジェクト: waffle-iron/nequeo
        public override bool Equals(
            object obj)
        {
            if (obj == this)
            {
                return(false);
            }

            SignerID id = obj as SignerID;

            if (id == null)
            {
                return(false);
            }

            return(Arrays.AreEqual(SubjectKeyIdentifier, id.SubjectKeyIdentifier) &&
                   Platform.Equals(SerialNumber, id.SerialNumber) &&
                   IssuersMatch(Issuer, id.Issuer));
        }