Added KeyGenerator and Exception classes