예제 #1
0
        /// <summary>
        /// Get the trust anchor group for the groupId.
        /// </summary>
        ///
        /// <param name="groupId">The group ID.</param>
        /// <returns>The trust anchor group.</returns>
        /// <exception cref="TrustAnchorContainer.Error">if the groupId does not exist.</exception>
        public TrustAnchorGroup getGroup(String groupId)
        {
            TrustAnchorGroup group = ILOG.J2CsMapping.Collections.Collections.Get(groups_, groupId);

            if (group == null)
            {
                throw new TrustAnchorContainer.Error("Trust anchor group "
                                                     + groupId + " does not exist");
            }

            return(group);
        }
예제 #2
0
        /// <summary>
        /// Insert a static trust anchor. If the certificate (having the same name
        /// without considering implicit digest) already exists in the group with
        /// groupId, then do nothing.
        /// </summary>
        ///
        /// <param name="groupId">The certificate group id.</param>
        /// <param name="certificate">The certificate to insert, which is copied.</param>
        /// <exception cref="TrustAnchorContainer.Error">If groupId is a dynamic anchor group .</exception>
        public void insert(String groupId, CertificateV2 certificate)
        {
            TrustAnchorGroup group = ILOG.J2CsMapping.Collections.Collections.Get(groups_, groupId);

            if (group == null)
            {
                group = new StaticTrustAnchorGroup(anchors_, groupId);
                ILOG.J2CsMapping.Collections.Collections.Put(groups_, groupId, group);
            }

            if (!(group  is  StaticTrustAnchorGroup))
            {
                throw new TrustAnchorContainer.Error(
                          "Cannot add a static anchor to the non-static anchor group "
                          + groupId);
            }

            ((StaticTrustAnchorGroup)group).add(certificate);
        }