Tag: spongycastle

从Base64编码的字符串中检索ECC公钥

我一直在尝试使用Base64编码的ECC公钥创建java.security.PublicKey的实例。 MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { byte[] data = decodePublicKey(“AsIAEFjzIcX+Kvhe8AmLoGUc8aYAEAwf5ecREGZ2u4RLxQuav/A=”); PublicKey publicKey = loadPublicKey(“secp128r1”, data); Log.d(TAG, publicKey.toString()); } catch (SQLException | IOException | GeneralSecurityException e) { Log.e(TAG, e.getMessage(), e); } } private byte[] decodePublicKey(String s) throws UnsupportedEncodingException { return Base64.decode(s, Base64.DEFAULT); } public PublicKey loadPublicKey(String curve, byte[] data) throws […]