remove import statement related to keypairgeneratorspec

move code to reflection to support lower SDK builds
Cool exception catching list!