KeyPair pair = SecureUtil.generateKeyPair("SM2"); byte[] privateKey = pair.getPrivate().getEncoded(); byte[] publicKey = pair.getPublic().getEncoded(); String private_key = ((BCECPrivateKey) pair.getPrivate()).getD().toString(16).toUpperCase(); System.out.println("private_key:----" + private_key); String pub_key = Hex.toHexString(((BCECPublicKey) pair.getPublic()).getQ().getEncoded(false)).toUpperCase(); System.out.println("pub_key---------" + pub_key);
标签:getEncoded,私钥,SM2,private,生成,pub,key,pair From: https://www.cnblogs.com/mafeizhouzi/p/16910676.html