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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? any_elgamal_pkcs1signature.java

?? jpeg2000編解碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
    }    /**     * Terminates the update process and returns the signature bytes of     * all the data signed so far.     * <p>     * <b>NOTES:</b> Sun's documentation talks about the bytes returned     * being X.509-encoded. For this ElGamal/PKCS#1 implementation, they     * conform to PKCS#1 section 10. Practically, the return value will     * be formed by concatenating a leading <i>NULL</i> byte, a block type     * <i>BT</i>, a padding block <i>PS</i>, another <i>NULL</i>byte, and     * finally a data block <i>D</i>;     * ie:     * <pre>     *     return = 0x00 || BT || PS || 0x00 || D.     * </pre>     * For signing, <i>PKCS#1 block type 01</i> encryption-block formatting     * scheme is employed. The block type <i>BT</i> is a single byte valued     * 0x01 and the padding block <i>PS</i> is enough 0xFF bytes to make the     * length of the complete Multi Precision Integer equal to the length     * of the public modulus. The data block <i>D</i> consists of the MIC --     * Message Integrity Check, or message digest value-- and the MIC     * algorithm ASN.1 encoded identifier. The formal syntax in ASN.1     * notation is:     * <pre>     *   SEQUENCE {     *     digestAlgorithm  AlgorithmIdentifier,     *     digest           OCTET STRING     *   }     *     *   AlgorithmIdentifier ::= SEQUENCE {     *     algorithm        OBJECT IDENTIFIER,     *     parameters       ANY DEFINED BY algorithm OPTIONAL     *   }     * </pre>     *     * @return the bytes of the signing operation's result.     * @exception SignatureException if the engine is not initialised properly.     */    protected byte[] engineSign()    throws SignatureException {        if (state != SIGN) throw new SignatureException(            getAlgorithm() + ": Not initialized for signing");        BigInteger pkcs = makePKCS1();        // sign the padded message.        BigInteger[] ab = new BigInteger[2];        ElGamalAlgorithm.sign(pkcs, ab, p, g, x, rng);/*        // DER-encode the result.        ASN1Value sig = new ASN1Sequence(new ASN1Value[] {                            new ASN1Integer(ab[0]),                            new ASN1Integer(ab[1]),                        });        return sig.derEncode();*///        byte[] aBytes = ab[0].toByteArray();//        byte[] bBytes = ab[1].toByteArray();//        byte[] signature = new byte[primeLen*2];//        System.arraycopy(aBytes, 0, signature, primeLen-aBytes.length, aBytes.length);//        System.arraycopy(bBytes, 0, signature, signature.length-bBytes.length, bBytes.length);//        return signature;        ByteArrayOutputStream baos = new ByteArrayOutputStream();        try {            BI.toStream(ab[0], baos);            BI.toStream(ab[1], baos);        } catch (IOException e) {            throw new SignatureException("BI.toStream() failed");        }        return baos.toByteArray();    }    /**     * Terminates the update process and verifies that the passed signature     * equals that of a generated one based on the updated data so far.     * <p>     * <b>NOTES:</b> Sun's documentation talks about the bytes received     * being X.509-encoded. For this ElGamal/PKCS#1 implementation, the bytes     * received are assumed to conform to PKCS#1 section 10, or have     * been generated by a previous invocation of the <code>engineSign</code>     * method.     *     * @param  signature    the signature bytes to be verified.     * @return true if the signature was verified successfully, false     *                      otherwise.     * @exception SignatureException if the engine is not initialised     *                      properly, the received signature data is improperly     *                      encoded or of the wrong type, etc.     */    protected boolean engineVerify(byte[] signature)    throws SignatureException {        if (state != VERIFY) throw new SignatureException(            getAlgorithm() + ": Not initialized for verification");        BigInteger pkcs = makePKCS1();/*        // BER-decode the signature.        ASN1Value value = null;        try {            value = new BERDecoder().decode(signature);            ASN1Sequence seq = (ASN1Sequence) value;            BigInteger a = ((ASN1Integer) (seq.elementAt(0))).BigIntegerValue();            BigInteger b = ((ASN1Integer) (seq.elementAt(1))).BigIntegerValue();            return ElGamalAlgorithm.verify(pkcs, a, b, p, g, y);        } catch (ASN1FormatException e) {            throw new InvalidKeyException("ElGamal: ASN.1 signature could not be decoded.");        } catch (ClassCastException e) {            throw new InvalidKeyException("ElGamal: ASN.1 signature has unexpected format.");        }*///        if (signature.length != primeLen*2)//            return false;//        byte[] temp = new byte[primeLen];//        System.arraycopy(signature, 0, temp, 0, primeLen);//        BigInteger a = new BigInteger(POSITIVE, temp);//        System.arraycopy(signature, 0, temp, 0, primeLen);//        BigInteger b = new BigInteger(POSITIVE, temp);        ByteArrayInputStream bais = new ByteArrayInputStream(signature);        BigInteger a, b;        try {            a = BI.fromStream(bais);            b = BI.fromStream(bais);        } catch (IOException e) {            throw new SignatureException("BI.fromStream() failed");        }        return ElGamalAlgorithm.verify(pkcs, a, b, p, g, y);    }    /**     * <b>SPI</b>: Sets an algorithm-specific parameter.     * <p>     * ElGamal has one algorithm-specific parameter called "random", of type     * java.util.Random. It specifies the source of random bits used for     * generating the <i>k</i> values needed for signing. If this parameter     * is not set when <code>initSign</code> is called, the result of     * <code>new SecureRandom()</code> will be used.     * <p>     * You can set the "random" parameter using the following code:     * <pre>     *   try {     *       elgamal.setParameter("random", random_number_generator);     *   } catch (InvalidParameterException e) { ... }     * </pre>     * <p>     * This is not useful if the Signature object will only be used for     * verification.     *     * @param param the string identifier of the parameter.     * @param value the parameter value.     * @exception InvalidParameterException if !(param.equals("random") &&     *          value instanceof java.util.Random)     */    protected void engineSetParameter(String param, Object value) {        if (param.equals("random")) {            if (!(value instanceof Random)) throw new InvalidParameterException(                "value must be an instance of java.util.Random");            rng = (Random) value;            return;        }        throw new InvalidParameterException(param);    }    /**     * <b>SPI</b>: Returns an algorithm-specific parameter.     * <p>     * ElGamal has one algorithm-specific parameter called "random", as described     * <a href="#engineSetParameter">above</a>. It is guaranteed to be a subclass     * of java.util.Random. Calling this method with a <i>param</i> string     * other than "random" will return null.     *     * @param param the string name of the parameter.     * @return the object that represents the parameter value, or null if there     *          is none.     */    protected Object engineGetParameter(String param) {        if (param.equals("random")) return rng;        return null;    }// Own methods//............................................................................    /**     * Returns a byte array consisting of a padded message digest value,     * previously computed. This packet will be ElGamal-signed with the     * private key of this object to act as an authentication for whatever     * was digested.     * <p>     * As described in the <i>engineSign()</i> method above, the return     * array will consist of:     * <pre>     *    MSB                                                            LSB     *    00  01   FF-1 ... FF-n  00   AID-1 ... AID-n   04 LL MD-1 ... MD-n     *      | BT |----- PS -----|    |-- AlgorithmId --|------ digest ------|     * </pre>     * <p>     * The <i>AID<i> bytes form the <i>AlgorithmIdentifier</i> token.     * The OCTET STRING tag is <i>04</i> and <i>LL</i> is the length byte     * (the number of bytes in the message digest proper, i.e. <i>n</i>).     * <p>     * Bytes <i>MD-1</i> to <i>MD-n</i> are the message digest value     * of the material updated so far, thus completing the <i>digest</i>     * token in the SEQUENCE described in <i>engineSign()</i> above.     *     * @return the result of the updating process framed in a PKCS#1     *         type 01 block structure as a BigInteger.     */    private BigInteger makePKCS1() {        byte[] theMD = md.digest();                            // stop hashing        int mdl = theMD.length;        // result has as many bytes as the prime        byte[] r = new byte[primeLen];        r[1] = 0x01;                           // PKCS#1 encryption block type        byte[] aid = getAlgorithmEncoding();              // get the AID bytes        int aidl = aid.length;//        int padLen = primeLen - 3 - aidl - mdl - 2;       // put padding bytes        int padLen = primeLen - 3 - aidl - mdl;       // put padding bytes        for (int i = 0; i < padLen; i++) r[2 + i] = (byte)0xFF;        System.arraycopy(aid, 0, r, padLen + 3, aidl);   // copy the AID bytes//        r[primeLen - mdl - 2] = 0x04;             // tag it as an OCTET STRING//        r[primeLen - mdl - 1] = (byte) mdl;          // and say how long it is        System.arraycopy(theMD, 0, r, primeLen - mdl, mdl);      // now the mdif (DEBUG && debuglevel >= 4) debug("PKCS#1 frame = " + Hex.dumpString(r));        return new BigInteger(r);         // always positive because r[0] is 0    }    /**     * Returns the ASN.1 bytes of the <i>AlgorithmIdentifier</i> token described     * in <code>engineSign()</code> method above.     *     * @return the <i>AlgorithmIdentifier</i> bytes.     */    protected abstract byte[] getAlgorithmEncoding();}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区自拍偷拍| 全国精品久久少妇| 蜜桃av一区二区在线观看| 国产aⅴ综合色| 欧美日韩国产综合一区二区三区 | 亚洲精品日韩综合观看成人91| 天天综合色天天| av一区二区三区| 日韩欧美一卡二卡| 一区二区视频在线| 成人深夜视频在线观看| 欧美一级黄色片| 一区二区三区欧美日| 国产不卡免费视频| 精品国产免费人成电影在线观看四季| 亚洲男人电影天堂| 丁香婷婷综合激情五月色| 日韩一区和二区| 石原莉奈一区二区三区在线观看| www.日韩在线| 亚洲国产成人自拍| 黑人精品欧美一区二区蜜桃 | 成人永久aaa| 精品国产乱码久久久久久免费| 午夜精品福利一区二区三区蜜桃| 99免费精品在线观看| 亚洲国产精品av| 国产成人精品一区二| 日韩免费一区二区| 麻豆专区一区二区三区四区五区| 欧美性一二三区| 亚洲小少妇裸体bbw| 色婷婷综合久久久久中文 | 欧美一区二区三区公司| 亚洲高清在线精品| 欧美亚洲一区二区三区四区| 亚洲激情网站免费观看| 色吊一区二区三区| 一区二区免费视频| 欧美图片一区二区三区| 亚洲综合免费观看高清完整版在线| 97se亚洲国产综合自在线观| 亚洲欧洲制服丝袜| 在线观看视频欧美| 天涯成人国产亚洲精品一区av| 欧美日韩国产精品成人| 久久精品一二三| 在线综合+亚洲+欧美中文字幕| 亚洲一区二区三区激情| 欧美亚洲一区二区在线观看| 亚洲国产美国国产综合一区二区| 欧美日韩国产综合久久| 日产国产欧美视频一区精品| 欧美变态凌虐bdsm| 国产精品资源在线观看| 日韩理论片一区二区| 在线一区二区视频| 人人精品人人爱| 久久亚洲影视婷婷| 99在线视频精品| 亚洲一区在线观看免费| 6080日韩午夜伦伦午夜伦| 久国产精品韩国三级视频| 欧美国产在线观看| 欧美优质美女网站| 久久精品国产精品亚洲精品| 欧美国产精品一区| 欧美影院精品一区| 国产精品综合二区| 一区二区三区免费看视频| 日韩免费看的电影| a在线欧美一区| 日本vs亚洲vs韩国一区三区二区| 久久久久高清精品| 欧美影片第一页| 国产一区二区精品久久| 亚洲乱码国产乱码精品精的特点| 久久久久国产精品厨房| 懂色av中文字幕一区二区三区 | 国产大陆亚洲精品国产| 中文字幕一区二区三区精华液| 在线视频中文字幕一区二区| 久久成人羞羞网站| 亚洲精品视频在线观看网站| 欧美精品一区二区不卡| 在线精品观看国产| 粉嫩蜜臀av国产精品网站| 亚洲国产一区二区三区| 中文字幕乱码一区二区免费| 欧美日韩免费高清一区色橹橹| 福利电影一区二区| 青青草国产精品亚洲专区无| 亚洲特级片在线| 国产日韩av一区| 日韩三级在线免费观看| 色欧美88888久久久久久影院| 国产成人免费在线观看不卡| 三级欧美韩日大片在线看| 1000精品久久久久久久久| 亚洲成人av在线电影| 日韩女优av电影在线观看| 成人伦理片在线| 首页欧美精品中文字幕| 亚洲视频一区在线| 久久久www成人免费毛片麻豆| 欧美日韩国产一级二级| 91欧美一区二区| 波多野结衣欧美| 国产黑丝在线一区二区三区| 奇米综合一区二区三区精品视频| 亚洲最大色网站| 国产女同互慰高潮91漫画| 2023国产精华国产精品| 精品久久免费看| 日韩免费一区二区三区在线播放| 欧美日韩一区二区三区四区五区| 色综合视频在线观看| 91在线观看下载| 91网站视频在线观看| 99久久久精品| 久草这里只有精品视频| 亚洲男人的天堂一区二区| 国产精品国产精品国产专区不蜜| 国产欧美日韩视频一区二区| 国产欧美日韩另类视频免费观看 | 国产精品一线二线三线| 国内一区二区在线| 国产乱码精品一区二区三区av| 国产乱人伦偷精品视频免下载 | 日韩一区二区三区观看| 欧美久久高跟鞋激| 91精品国产综合久久精品图片| 欧美一区二区播放| 精品久久久三级丝袜| 久久综合九色综合97婷婷女人| 国产亚洲一区二区在线观看| 中文字幕乱码一区二区免费| 亚洲欧美日韩一区二区| 亚洲高清久久久| 久久精品国产成人一区二区三区 | 国产成人av电影在线| 成人18视频在线播放| 色婷婷亚洲一区二区三区| 精品婷婷伊人一区三区三| 91麻豆精品91久久久久久清纯 | 麻豆成人免费电影| 国产精品一区专区| 一本色道久久加勒比精品| 欧美精品在线一区二区三区| 精品国产电影一区二区| 国产精品日韩成人| 亚洲高清不卡在线| 国产精品一线二线三线| 欧美中文字幕一二三区视频| 欧美tickling网站挠脚心| 国产精品素人视频| 三级久久三级久久| 成人aaaa免费全部观看| 91精品免费观看| 国产精品久久久久天堂| 日本不卡123| 99精品国产99久久久久久白柏| 日韩国产在线观看一区| 久久亚洲欧美国产精品乐播 | 亚洲乱码中文字幕综合| 婷婷成人激情在线网| 粉嫩在线一区二区三区视频| 欧美日韩三级视频| 国产精品沙发午睡系列990531| 日韩中文字幕一区二区三区| 成人激情电影免费在线观看| 3atv一区二区三区| 亚洲三级电影网站| 精品中文av资源站在线观看| 色婷婷综合中文久久一本| 2019国产精品| 天堂一区二区在线免费观看| 99久久精品免费精品国产| 精品动漫一区二区三区在线观看| 亚洲国产裸拍裸体视频在线观看乱了 | 天天操天天综合网| jiyouzz国产精品久久| 日韩欧美中文一区二区| 一区二区三区国产| 成人黄色av网站在线| 久久综合九色综合久久久精品综合| 五月天网站亚洲| 欧美性xxxxxx少妇| 亚洲欧美日韩一区| 成人av综合在线| 久久九九国产精品| 国产原创一区二区| 日韩视频不卡中文| 日本美女视频一区二区| 欧美日韩一区三区| 蜜桃视频第一区免费观看| 欧美视频中文字幕| 亚洲综合免费观看高清在线观看| 91在线码无精品| 中文字幕制服丝袜成人av |