owlstead是正确的。要详细说明,您可以执行以下 *** 作:
KeyPair pair = GenerateKeys();Signature ecdsaSign = Signature.getInstance("SHA256withECDSA", "BC");ecdsaSign.initSign(pair.getPrivate());ecdsaSign.update(plaintext.getBytes("UTF-8"));byte[] signature = ecdsaSign.sign();
并验证:
Signature ecdsaVerify = Signature.getInstance("SHA256withECDSA", "BC");ecdsaVerify.initVerify(pair.getPublic());ecdsaVerify.update(plaintext.getBytes("UTF-8"));boolean result = ecdsaVerify.verify(signature);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)