RSAEncSignDemo
RSAEncSignDemo copied to clipboard
RSA Encode Signature Demo,include java server , web , android , ios
鏈嶅姟绔疉PI鍔犵DEMO璇存槑
鏈珼emo鍖呭惈 Java鍚庡彴锛寃eb鍓嶇锛孉ndroid锛宨OS
涓轰簡鍚勪釜缁堢鍏煎锛岄噰鐢╫penssl鐢熸垚瀵嗛挜瀵?/h2>
璇峰畨瑁呮渶鏂?openssl , 杩愯 generateRSAKeypair.sh 鐢熸垚銆? 鍔″繀璁颁綇涓€旀彁绀鸿緭鍏ョ殑瀵嗙爜锛宨OS闇€瑕佺敤鍒般€?
Demo 浣跨敤鐨勪竴浠藉瘑閽ユ枃浠朵綅浜?key 鐩綍
濡備綍绛惧悕
璇峰畨瑁呮渶鏂?openssl , 杩愯 generateRSAKeypair.sh 鐢熸垚銆? 鍔″繀璁颁綇涓€旀彁绀鸿緭鍏ョ殑瀵嗙爜锛宨OS闇€瑕佺敤鍒般€?
Demo 浣跨敤鐨勪竴浠藉瘑閽ユ枃浠朵綅浜?key 鐩綍
1.绛涢€夊苟鎺掑簭
鑾峰彇鎵€鏈夎姹傚弬鏁帮紝涓嶅寘鎷瓧鑺傜被鍨嬪弬鏁帮紝濡傛枃浠躲€佸瓧鑺傛祦锛屽墧闄ign瀛楁锛屽墧闄ゅ€间负绌虹殑鍙傛暟锛屽苟鎸夌収绗竴涓瓧绗︾殑閿€糀SCII鐮侀€掑鎺掑簭锛堝瓧姣嶅崌搴忔帓搴忥級锛屽鏋滈亣鍒扮浉鍚屽瓧绗﹀垯鎸夌収绗簩涓瓧绗︾殑閿€糀SCII鐮侀€掑鎺掑簭锛屼互姝ょ被鎺ㄣ€?/p>
2.鎷兼帴
灏嗘帓搴忓悗鐨勫弬鏁颁笌鍏跺搴斿€硷紝缁勫悎鎴愨€滃弬鏁?鍙傛暟鍊尖€濈殑鏍煎紡锛屽苟涓旀妸杩欎簺鍙傛暟鐢?amp;瀛楃杩炴帴璧锋潵锛屾鏃剁敓鎴愮殑瀛楃涓蹭负寰呯鍚嶅瓧绗︿覆銆?/p>
渚嬪涓嬮潰鐨勮姹傜ず渚嬶紝鍙傛暟鍊奸兘鏄ず渚嬶紝寮€鍙戣€呭弬鑰冩牸寮忓嵆鍙細
REQUEST URL: https://openapi.alipay.com/gateway.do
REQUEST METHOD: POST
CONTENT:
app_id=2014072300007148
method=alipay.mobile.public.menu.add
charset=GBK
sign_type=RSA2
timestamp=2014-07-24 03:07:50
biz_content={"button":[{"actionParam":"ZFB_HFCZ","actionType":"out","name":"璇濊垂鍏呭€?quot;},{"name":"鏌ヨ","subButton":[{"actionParam":"ZFB_YECX","actionType":"out","name":"浣欓鏌ヨ"},{"actionParam":"ZFB_LLCX","actionType":"out","name":"娴侀噺鏌ヨ"},{"actionParam":"ZFB_HFCX","actionType":"out","name":"璇濊垂鏌ヨ"}]},{"actionParam":"http://m.alipay.com","actionType":"link","name":"鏈€鏂颁紭鎯?quot;}]}
sign=e9zEAe4TTQ4LPLQvETPoLGXTiURcxiAKfMVQ6Hrrsx2hmyIEGvSfAQzbLxHrhyZ48wOJXTsD4FPnt+YGdK57+fP1BCbf9rIVycfjhYCqlFhbTu9pFnZgT55W+xbAFb9y7vL0MyAxwXUXvZtQVqEwW7pURtKilbcBTEW7TAxzgro=
version=1.0
鍒欏緟绛惧悕瀛楃涓蹭负锛?/p>
app_id=2014072300007148&biz_content={"button":[{"actionParam":"ZFB_HFCZ","actionType":"out","name":"璇濊垂鍏呭€?quot;},{"name":"鏌ヨ","subButton":[{"actionParam":"ZFB_YECX","actionType":"out","name":"浣欓鏌ヨ"},{"actionParam":"ZFB_LLCX","actionType":"out","name":"娴侀噺鏌ヨ"},{"actionParam":"ZFB_HFCX","actionType":"out","name":"璇濊垂鏌ヨ"}]},{"actionParam":"http://m.alipay.com","actionType":"link","name":"鏈€鏂颁紭鎯?quot;}]}&charset=GBK&method=alipay.mobile.public.menu.add&sign_type=RSA2×tamp=2014-07-24 03:07:50&version=1.0
3.璋冪敤绛惧悕鍑芥暟
浣跨敤鍚勮嚜璇█瀵瑰簲鐨凷HA256WithRSA绛惧悕鍑芥暟鍒╃敤绉侀挜瀵瑰緟绛惧悕瀛楃涓茶繘琛岀鍚嶏紝骞惰繘琛孊ase64缂栫爜銆?/p>
4.鎶婄敓鎴愮殑绛惧悕璧嬪€肩粰sign鍙傛暟锛屾嫾鎺ュ埌璇锋眰鍙傛暟涓紝姣斿銆?/p>
...&sign=DuB3sIXLrFi96WgDQWn048wtlNeqwprT/URnFa4k4DJSmjJjZzFFyKh9LcK0WhSRmvP0k3duFrMVpZMy/q5CYULnl2cIXBdlH4rD6EmCGxMdWcTUTp2I1Z4mHt4+RMyIEU64Xd9nLmId3A4G3xX8dgJek5vaKVoX6BXPMeCz0gI=
鍏蜂綋璇峰弬鑰冩瘡绉嶅鎴风鐨勫叿浣揇EMO銆?/p>
鍙傛暟鍔犲瘑
鍙傛暟鍔犲瘑浣跨敤 rsa 鍏挜锛屾瘡涓」鐩兘鏈塪emo
鍓嶇js鍔犲瘑娣锋穯
璇峰弬鑰?http://div.io/topic/1220#
https://www.zhihu.com/question/20306249
DEMO璇存槑
璇峰弬鑰冩瘡涓」鐩叿浣撲唬鐮侊紝鍖呭惈 java server, web, android, ios