I am getting the above error in this particular line of code:
KeyFactory keyFactory=keyFactory.getInstance(keyAlgorithm);
EncodedKeySpec privateKeySpec=new PKCS8EncodedKeySpec(privateKeyBytes);
PrivateKey privateKey1=keyFactory.generatePrivate(privateKeySpec);
To be precise this is the error I get:
GeneratePublicPrivateKeys.java:35: error: non-static method generatePublic(KeySp
ec) cannot be referenced from a static context
PublicKey publicKey1=KeyFactory.generatePublic(publicKey
Spec);
Note: I have gone through these posts
“Non-static method cannot be referenced from a static context” error
non static method cannot be referenced from a static context
and some more and I have tried the solutions provided there,but no they do not solve my problem
What should I do?
Thankyou in advance:)