{"id":1512,"date":"2023-03-25T14:02:51","date_gmt":"2023-03-25T06:02:51","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1512"},"modified":"2023-04-28T20:21:00","modified_gmt":"2023-04-28T12:21:00","slug":"provider-bouncycastleprovider-library-import-for-algorithm-and-certificate-generation","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/provider-bouncycastleprovider-library-import-for-algorithm-and-certificate-generation\/","title":{"rendered":"provider.BouncyCastleProvider\u5e93\u5bfc\u5165\u7528\u4e8e\u7b97\u6cd5\u548c\u751f\u6210\u8bc1\u4e66"},"content":{"rendered":"<h2>\u4f9d\u8d56\u5f15\u5165<\/h2>\n<pre><code class=\"language-xml\">&lt;!-- https:\/\/mvnrepository.com\/artifact\/org.bouncycastle\/bcpg-jdk15on --&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;org.bouncycastle&lt;\/groupId&gt;\n    &lt;artifactId&gt;bcpg-jdk15on&lt;\/artifactId&gt;\n    &lt;version&gt;1.66&lt;\/version&gt;\n&lt;\/dependency&gt;<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>bcpg-jdk\u6240\u6709\u7248\u672c\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/www.mvnjar.com\/org.bouncycastle\/list.html\">https:\/\/www.mvnjar.com\/org.bouncycastle\/list.html<\/a><\/p>\n<h2>\u7b97\u6cd5\u4f7f\u7528<\/h2>\n<pre><code class=\"language-java\">static {\n    Security.addProvider(new BouncyCastleProvider());\n}<\/code><\/pre>\n<h2>\u8bc1\u4e66\u5236\u4f5c<\/h2>\n<p>\u7528\u4e8e\u5236\u4f5cAndroid App\u8fdb\u884cSSL\u901a\u4fe1\u65f6\u6240\u9700\u4f7f\u7528\u7684bks\u683c\u5f0f\u8bc1\u4e66\u3002<\/p>\n<p>\u4e3a\u4e86\u751f\u6210Android\u7528\u7684BKS\u8bc1\u4e66\u6587\u4ef6\uff0c\u91c7\u53d6\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<p>1.\u4e0b\u8f7d<code>bcprov-ext-jdk15on-166.jar<\/code>\uff0c\u590d\u5236\u5230<code>jdk_home\\jre\\lib\\ext<\/code><\/p>\n<p>2.\u914d\u7f6e<code>bcprov<\/code>\uff0c\u5728<code>jdk_home\\jre\\lib\\security\\<\/code>\u76ee\u5f55\u4e2d\u627e\u5230<code>java.security<\/code>\u5728\u5185\u5bb9\u589e\u52a0\u4e00\u884c<\/p>\n<pre><code>security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider<\/code><\/pre>\n<p>3.\u751f\u6210Android\u5e73\u53f0\u7684\u8bc1\u4e66<\/p>\n<pre><code>keytool -importcert -keystore tclientapi.bks -file api.cert -storetype BKS -provider org.bouncycastle.jce.provider.BouncyCastleProvider -alias api<\/code><\/pre>\n<p>\u5176\u4e2d<code>api.cert<\/code>\u4e3a\u670d\u52a1\u5668\u8bc1\u4e66\uff0c<code>tclientapi.bks<\/code>\u662f\u751f\u6210\u7684Android\u8bc1\u4e66\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f9d\u8d56\u5f15\u5165 &lt;!&#8211; https:\/\/mvnrepository.com\/artifact\/org.bou [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-1512","post","type-post","status-publish","format-standard","hentry","category-java-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1512"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1512\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}