亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testsignature.java

?? p2p 源代碼
?? JAVA
字號:
import java.util.*;import net.jxta.document.*;import jxta.security.util.URLBase64;import jxta.security.signature.Signature;import jxta.security.crypto.JxtaCrypto;import jxta.security.publickey.PublicKeyAlgorithm;import jxta.security.impl.publickey.RSAPublickeyData;import jxta.security.impl.publickey.RSAPrivatekeyData;import jxta.security.impl.publickey.RSAKey;import jxta.security.impl.cipher.KeyBuilder;import jxta.security.impl.crypto.JxtaCryptoSuite;public class TestSignature {    static RSAPublickeyData publicKeyData;    static RSAPrivatekeyData privateKeyData;    // Get the data to sign into the buffer. The data must always appear in    // the same order, which is why we can抰 just enumerate through all the    // elements in the document; we must look them up in a specific order.    // Returns the length of the data to sign    public static int getDataToSign(StructuredDocument doc, byte[] buf) throws Exception {        int length = 0;        Enumeration enum = doc.getChildren("Price");        while (enum.hasMoreElements()) {            Element element = (Element) enum.nextElement();            String value = (String) element.getValue();            byte[] temp = value.getBytes();            System.arraycopy(temp, 0, buf, length, temp.length);            length += temp.length;        }        enum = doc.getChildren("Brand");        while (enum.hasMoreElements()) {            Element element = (Element) enum.nextElement();            String value = (String) element.getValue();            byte[] temp = value.getBytes();            System.arraycopy(temp, 0, buf, length, temp.length);            length += temp.length;        }        return length;    }    public static boolean validateMessage(StructuredDocument doc) throws Exception {        // Step 1: Generate and initialize the necessary RSA key        RSAKey rsaKey = (RSAKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA,                                                KeyBuilder.LENGTH_RSA_512,                                                false);        // Step 2: Create a profile that can do signing        JxtaCrypto jc = new JxtaCryptoSuite(JxtaCrypto.PROFILE_RSA_SHA1,                                            rsaKey,                                            Signature.ALG_RSA_SHA_PKCS1,                                            (byte) 0);        // Step 3: Initialize the key based on the saved data (e.g.,        // you'd normally read this data from persistent store        // Since we're validating the signature, use the public key        PublicKeyAlgorithm pka = jc.getJxtaPublicKeyAlgorithm();        pka.setPublicKey(publicKeyData);        // Step 4: Get the data from the document. In this case, we also        // need the signature data        byte[] data = new byte[1024];        int length = getDataToSign(doc, data);        Enumeration enum = doc.getChildren("Signature");        byte[] signature = null;        while (enum.hasMoreElements()) {            Element element = (Element) enum.nextElement();            String value = (String) element.getValue();            byte[] enc = value.getBytes();            signature = URLBase64.decode(enc, 0, enc.length);        }        // Step 5: Get the signature object, initialize it, and verify        Signature s = jc.getJxtaSignature();        s.init(Signature.MODE_VERIFY);        boolean verified = s.verify(data, 0, length, signature, 0, signature.length);        return verified;    }    public static void signMessage(StructuredDocument doc) throws Exception {        // Step 1: Generate and initialize the necessary RSA key        RSAKey rsaKey = (RSAKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA,                                                KeyBuilder.LENGTH_RSA_512,                                                false);        // Step 2: Create a profile that can do signing        JxtaCrypto jc = new JxtaCryptoSuite(JxtaCrypto.PROFILE_RSA_SHA1,                                            rsaKey,                                            Signature.ALG_RSA_SHA_PKCS1,                                            (byte) 0);        // Step 3: Initialize the key based on the saved data (e.g.,        // you'd normally read this data from persistent store        PublicKeyAlgorithm pka = jc.getJxtaPublicKeyAlgorithm();        pka.setPublicKey(publicKeyData);        pka.setPrivateKey(privateKeyData);        // Step 4: Get the signature object, initialize it, and sign the data        Signature s = jc.getJxtaSignature();        s.init(Signature.MODE_SIGN);        byte[] data = new byte[1024];        int length = getDataToSign(doc, data);        byte[] signature = s.sign(data, 0, length);        // Step 5: Add the signature to the document        Element el = doc.createElement("Signature",                         new String(URLBase64.encode(signature)));        doc.appendChild(el);    }    public static void main(String[] args) throws Exception {        // Step 1: Generate and initialize the necessary RSA key        RSAKey rsaKey = (RSAKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA,                                                KeyBuilder.LENGTH_RSA_512,                                                false);        // Step 2: Create a profile that can do signing        JxtaCrypto jc = new JxtaCryptoSuite(JxtaCrypto.PROFILE_RSA_SHA1,                                            rsaKey,                                            Signature.ALG_RSA_SHA_PKCS1, (byte) 0);        // Step 3: Complete the initialization of the keys        PublicKeyAlgorithm pka = jc.getJxtaPublicKeyAlgorithm();        pka.setPublicKey();        pka.setPrivateKey();        // Step 4: Save the public/private key data. Normally, these would        // go into persistent storage, and the HungyPeer would be sent        // the public key        publicKeyData = (RSAPublickeyData) pka.getPublickey();        privateKeyData = (RSAPrivatekeyData) pka.getPrivatekey();        // Step 5: Create the document, just as we did in the RestoPeer        StructuredDocument bid =            StructuredDocumentFactory.newStructuredDocument(                        new MimeMediaType("text", "xml"),                        "RestoNet:Bid");        Element el = bid.createElement("Brand", "Chez JXTA");        bid.appendChild(el);        el = bid.createElement("Price", "$1.00");        bid.appendChild(el);        // Step 6: Sign the document        signMessage(bid);        // Step 7: Validate the document        // We'd normally transmit the document and the recipient        // would validate its signature. We'll just do that in place        boolean valid = validateMessage(bid);        System.out.println("Signature was " + ((valid) ? "ok" : "invalid"));    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美美女一区二区三区| 一区二区三区久久久| 中文字幕视频一区| 亚洲成av人综合在线观看| 国产suv精品一区二区三区| 欧美日韩一区二区电影| 国产精品久久久久久久第一福利| 日韩国产精品大片| 日本道色综合久久| 日本一区二区综合亚洲| 久草中文综合在线| 欧美精品免费视频| 亚洲午夜精品网| 91成人在线精品| 亚洲国产岛国毛片在线| 精品亚洲成a人| 777久久久精品| 香蕉久久夜色精品国产使用方法| 99久久精品费精品国产一区二区| 久久久久久电影| 精品一区二区三区在线视频| 在线不卡免费欧美| 青青草视频一区| 日本一区二区免费在线| 天堂成人国产精品一区| 欧美在线观看18| 一区二区三区国产豹纹内裤在线 | 91视频精品在这里| 国产调教视频一区| 国产成人免费在线视频| 精品88久久久久88久久久| 精品在线一区二区三区| 精品国产伦一区二区三区观看体验| 日韩黄色小视频| 制服.丝袜.亚洲.中文.综合| 亚洲福利视频一区| 欧美美女直播网站| 日韩国产高清影视| 欧美va亚洲va香蕉在线 | 亚洲一区二区高清| 欧美色区777第一页| 日韩av一区二区三区四区| 精品国产免费久久 | 色噜噜狠狠成人中文综合| 亚洲美女免费在线| 欧美色综合网站| 蜜臀久久99精品久久久久久9 | 在线观看国产日韩| 视频在线观看一区| 久久久久国产精品免费免费搜索| 国产精品夜夜嗨| 18欧美亚洲精品| 制服丝袜亚洲网站| 国产成人欧美日韩在线电影| 亚洲色图欧洲色图婷婷| 欧美精品在线观看一区二区| 美日韩一区二区三区| 国产欧美一区二区三区在线老狼 | 国产精品久久午夜夜伦鲁鲁| 91成人在线免费观看| 久久精品国产**网站演员| 国产精品久久久久影院老司| 欧美在线看片a免费观看| 久久精品99国产精品日本| 国产精品久久久99| 777欧美精品| 成人午夜视频在线观看| 午夜精品123| 久久精品日韩一区二区三区| 色哟哟国产精品| 美女诱惑一区二区| 一区二区三区影院| 久久精品亚洲一区二区三区浴池| 一本高清dvd不卡在线观看| 久久99精品国产麻豆婷婷| 亚洲黄色免费网站| 久久久久国产免费免费 | 国产**成人网毛片九色| 亚洲午夜免费福利视频| 国产精品日日摸夜夜摸av| 欧美一级午夜免费电影| 一本久久精品一区二区| 国产乱码精品一区二区三| 午夜日韩在线电影| 亚洲人123区| 国产亚洲欧洲997久久综合| 欧美伦理电影网| 91蝌蚪porny成人天涯| 国产尤物一区二区在线| 日韩av一区二| 一区二区三区av电影 | 成人高清免费在线播放| 久久国产三级精品| 日韩黄色小视频| 一区二区久久久| 亚洲欧美日韩国产成人精品影院 | 精品国免费一区二区三区| 欧美日韩国产天堂| 色噜噜狠狠色综合中国| 波多野结衣视频一区| 国产精品一区在线| 韩国精品一区二区| 老司机午夜精品| 蜜臀av性久久久久蜜臀aⅴ| 亚洲影视资源网| 一区二区三区中文免费| 亚洲色欲色欲www在线观看| 国产精品美女久久久久久 | 成人理论电影网| 国产成人免费av在线| 国产精品一区二区黑丝| 韩国中文字幕2020精品| 精品一区二区三区欧美| 看片的网站亚洲| 老司机精品视频一区二区三区| 日本美女一区二区三区视频| 偷拍日韩校园综合在线| 奇米影视一区二区三区| 日本成人在线不卡视频| 另类小说综合欧美亚洲| 国产曰批免费观看久久久| 国产在线国偷精品产拍免费yy| 国产一区二区不卡| 国产凹凸在线观看一区二区| 成人动漫视频在线| 91在线你懂得| 欧美日韩精品系列| 精品国产乱码久久久久久老虎 | 亚洲欧美日韩系列| 一区二区三区四区蜜桃| 三级不卡在线观看| 激情久久五月天| www.日韩大片| 欧美三级电影网站| 日韩精品一区二区三区中文精品| 精品三级在线观看| 国产精品女同互慰在线看| 亚洲在线观看免费视频| 免费人成在线不卡| 欧美日韩二区三区| 精品处破学生在线二十三| 精品日韩欧美在线| 亚洲欧美视频在线观看视频| 亚洲精品一区二区三区精华液| 久久婷婷色综合| 亚洲男女一区二区三区| 日韩成人免费电影| 成人av网站免费观看| 欧美日韩国产一区| 国产亚洲精品超碰| 亚洲成人av免费| 国产精品1区2区| 精品视频在线免费看| 久久久久久久久久久99999| 怡红院av一区二区三区| 极品美女销魂一区二区三区免费| 91伊人久久大香线蕉| 欧美一级免费观看| 中文字幕亚洲电影| 裸体健美xxxx欧美裸体表演| 91浏览器入口在线观看| 精品国产乱码久久久久久图片 | 成人免费一区二区三区在线观看| 亚洲伊人色欲综合网| 国产凹凸在线观看一区二区| 欧美福利电影网| 日韩码欧中文字| 精品无人码麻豆乱码1区2区| 欧美日韩另类一区| 亚洲欧洲日韩在线| 国产精品羞羞答答xxdd| 日韩一区二区在线观看视频播放| 一区二区三区在线播放| 成人三级伦理片| 欧美成人女星排名| 亚洲欧美韩国综合色| 国产成人综合亚洲网站| 日韩精品中午字幕| 午夜成人免费视频| 日本韩国欧美在线| 国产精品久久久久毛片软件| 国产精品亚洲专一区二区三区| 欧美一卡二卡三卡四卡| 亚洲小说春色综合另类电影| aaa亚洲精品| 欧美激情一区二区三区四区| 狠狠网亚洲精品| 日韩欧美亚洲一区二区| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美男人的天堂一二区| 亚洲宅男天堂在线观看无病毒| av电影一区二区| 国产欧美一二三区| 不卡一区二区在线| 国产精品高潮久久久久无| aa级大片欧美| 亚洲伦在线观看| 91欧美一区二区| 亚洲九九爱视频| 色噜噜狠狠一区二区三区果冻|