A method and apparatus for negotiating a shared secret among members of a
multicast group are disclosed. A tree that represents the group is
created and stored in a memory. Each node of the tree is associated with
a group member. The shared secret is generated by traversing the tree in
post-order, and at each node of the tree, recursively generating a
partial key value for use in the shared secret and a base value for use
in subsequent recursive partial key value generation. At each node, a
partial key value is computed by accumulating the exponent portion of the
Diffie-Hellman key equation and computing a new base value for use in
subsequent computations. If a particular node has a left or right child
sub-tree, each sub-tree is also recursively traversed in post-order
fashion. When traversal of the entire tree is complete, all nodes have
the shared secret key.