I read a lot of similar topics on SO but I am still a little bit confused.
I have a public key in .pub format (pure public key). The question is if it is possible to read it in this format in Java. I am able to read public key if it has .der format.
RSAPublicKey publicKey
= (RSAPublicKey) KeyFactory.getInstance("RSA").
generatePublic(new X509EncodedKeySpec(FileCopyUtils.
copyToByteArray(resource.getInputStream())));
Works fine. However it is not working for .pub format. If the only option is to read der file how should I correctly convert .pub to .der. Thanks in advance for any help.