Ejemplo n.º 1
0
    ///<summary>When a SecurityAssociation changes amongst inactive, active,
    ///or closed this gets notified.</summary>
    protected void AnnounceSA(object o, EventArgs ea) {
      SecurityAssociation sa = o as SecurityAssociation;
      if(sa == null) {
        throw new Exception("Needs to be a SecurityAssociation");
      }

      Edge e = sa.Sender as Edge;
      // if e is an edge, let's see if he's creating a SE
      // or maybe it isn't our edge!
      if(e == null) {
        return;
      } else if(e.TAType != this.TAType) {
        return;
      }

      if(sa.Active) {
        SecureEdge se = new SecureEdge(e, sa);
        sa.Subscribe(se, null);
        try {
          Finalize(se);
        } catch {
          se.Close();
        }
      } else {
        e.Close();
      }
    }
Ejemplo n.º 2
0
        ///<summary>Verify the edge by comparing the address in the certificate to
        ///the one provided in the overlay.</summary>
        public static bool AddressInSubjectAltName(Node node, Edge e, Address addr)
        {
            SecureEdge se = e as SecureEdge;

            if (se == null)
            {
                throw new Exception("Invalid edge type!");
            }

            return(se.SA.VerifyCertificateBySubjectAltName(addr.ToString()));
        }
Ejemplo n.º 3
0
    ///<summary>When a SecurityAssociation changes amongst inactive, active,
    ///or closed this gets notified.</summary>
    protected void AnnounceSA(SecurityAssociation sa,
        SecurityAssociation.States state)
    {
      Edge e = sa.Sender as Edge;
      // if e is an edge, let's see if he's creating a SE
      // or maybe it isn't our edge!
      if(e == null) {
        return;
      } else if(e.TAType != this.TAType) {
        return;
      }

      if(state == SecurityAssociation.States.Active) {
        SecurityAssociation stored_sa = null;
        if(!RemoveFromDictionary(e, out stored_sa)) {
          // May have already been here
          return;
        } else if(stored_sa != null && stored_sa != sa) {
          throw new Exception("Cannot have the same edge used in multiple SAs");
        }

        SecureEdge se = new SecureEdge(e, sa);
        sa.Subscribe(se, null);
        try {
          Finalize(se);
        } catch {
          se.Close();
        }
      } else if(state == SecurityAssociation.States.Closed) {
        e.Close();
      }
    }