Loading raw 64-byte long ECDSA public key in Java
I have a raw (r,s) format ECDSA NIST P-256 public key. It seems that there is no simple way to load it into an object that implements java.security.interfaces.ECPublicKey. What is the cleanest way to load a 64 byte public key so that it can be used to check signatures? This answer is going to be tough if we do this using ECPublicKeySpec . So lets cheat a bit: private static byte[] P256_HEAD = Base64.getDecoder().decode("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE"); public static ECPublicKey convertP256Key(byte[] w) throws InvalidKeySpecException { byte[] encodedKey = new byte[P256_HEAD.length + w