{"id":759,"date":"2023-09-19T09:01:01","date_gmt":"2023-09-19T01:01:01","guid":{"rendered":""},"modified":"2023-09-19T09:01:01","modified_gmt":"2023-09-19T01:01:01","slug":"java \u516c\u94a5 \u9a8c\u8bc1_Java\u4ee3\u7801\u7b7e\u540d\u9a8c\u8bc1\u516c\u94a5\u79c1\u94a5","status":"publish","type":"post","link":"https:\/\/mushiming.com\/759.html","title":{"rendered":"java \u516c\u94a5 \u9a8c\u8bc1_Java\u4ee3\u7801\u7b7e\u540d\u9a8c\u8bc1\u516c\u94a5\u79c1\u94a5"},"content":{"rendered":"
\n

Java\u9a8c\u8bc1\u516c\u94a5\u79c1\u94a5\u7b7e\u540d\u8ba4\u8bc1\u793a\u4f8b\u5982\u4e0b<\/p>\n

importsecurity.KeyPair;<\/p>\n

importsecurity.KeyPairGenerator;<\/p>\n

importsecurity.NoSuchAlgorithmException;<\/p>\n

importsecurity.Signature;<\/p>\n

\/**<\/p>\n

*<\/p>\n

* @since 2015\u5e748\u670820\u65e5 \u4e0b\u53482:22:08<\/p>\n

* @author hym<\/p>\n

*\/<\/p>\n

publicclass SignDemo {
\n <\/p>\n

\/**\u5f97\u5230\u4ea7\u751f\u7684\u79c1\u94a5\/\u516c\u94a5\u5bf9<\/p>\n

* @return<\/p>\n

* @author hym<\/p>\n

*\/<\/p>\n

public static KeyPair getKeypair(){
\n <\/p>\n

\/\/\u4ea7\u751fRSA\u5bc6\u94a5\u5bf9(myKeyPair)<\/p>\n

KeyPairGenerator myKeyGen = null;<\/p>\n

try {
\n <\/p>\n

myKeyGen = KeyPairGenerator.getInstance(\u201cRSA\u201d);<\/p>\n

initialize(1024);<\/p>\n

} catch (NoSuchAlgorithmException e) {
\n <\/p>\n

printStackTrace();<\/p>\n

}<\/p>\n

KeyPair myKeyPair = myKeyGen.generateKeyPair();<\/p>\n

return myKeyPair;<\/p>\n

}<\/p>\n

\/**\u6839\u636e\u5bc6\u94a5\u5bf9\u5bf9\u4fe1\u606f\u8fdb\u884c\u52a0\u5bc6\uff0c\u8fd4\u56de\u516c\u94a5\u503c<\/p>\n

* @param mySig<\/p>\n

* @param myKeyPair<\/p>\n

* @para<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"java \u516c\u94a5 \u9a8c\u8bc1_Java\u4ee3\u7801\u7b7e\u540d\u9a8c\u8bc1\u516c\u94a5\u79c1\u94a5Java\u9a8c\u8bc1\u516c\u94a5\u79c1\u94a5\u7b7e\u540d\u8ba4\u8bc1\u793a\u4f8b\u5982\u4e0bimportsecurity.KeyPair;importsecurity.KeyPairG...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/759"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=759"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/759\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}