added validation for dh generatoion and more tests