Fixed key agreement script and added generator to output