Fix issues parsing key and generating exponent