我想将字节数组转换为PublicKey。问题在于字节数组来(或应该来)用ECDH编码并且是公钥X509。它是DNIe的公钥。我一直在用此代码进行测试,但是它在我转换的那一行上返回“检测过早的EOF”:
Data(en hex) = 0bbe0c8f66d755020f6a2a656c1111664c745836ac7dafbde0af484bd66b1d31a0ba7da687acd0ee1b695b54ea274d495cb613e90d3277159827f54f316e5833
public static PublicKey loadPublicKey (byte[] data) throws Exception{
PublicKey publicKey = KeyFactory.getInstance("EC").generatePublic(new X509EncodedKeySpec(data));}