xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 6KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-15
  • 語言: Java
  • 標簽:

資源簡介

簡單的數字簽名系統、java、可運行、簡單的數字簽名系統

資源截圖

代碼片段和文件信息

package?jct;


import?javax.crypto.*;
import?javax.crypto.spec.*;
import?java.security.Key;
import?java.security.KeyFactory;
import?java.security.spec.EncodedKeySpec;
import?java.security.Security;
import?java.security.*;
import?java.util.Random;
import?java.util.Vector;

/**
?*?

封裝同Blowfish對稱加密算法有關的方法,包括了使用創建Blowfish密碼,使用Blowfish加密、解密?使用PBE(基于口令的加密)存取blowfiwsh密碼?


?*?@Copyright:WDSsoft
?*?@ad:WDSsoft?“企業多級數字簽名系統”-?最佳的企業電子文檔多級數字簽名方案
?*?@URL:www.wdssoft.com
?*?@作者?吳東升?mdss@wdssoft.com?bluesunday@sohu.com
?*/



public?class?BlowfishTool?{

??public?BlowfishTool()?{
??}
/**
?*?使用Blowfish加密
?*?@param?Key?key:密碼
?*?@param?byte[]?text:明文
?*?@return?byte[]:密文
?*/
??public?static?byte[]?encryptReturnByte(Key?keybyte[]?text){
?????try{
?????????Cipher?cipher=Cipher.getInstance(“Blowfish/ECB/PKCS5Padding“);
?????????cipher.init(Cipher.ENCRYPT_MODEkey);
?????????return?cipher.doFinal(text);
?????}catch(Exception?e){??return?null;????}
??}
/**
?*?Blowfish解密
?*?@param?Key?key:密碼
?*?@param?byte[]?text:密文
?*?@return?byte[]?:?明文
?*/
???public?static?byte[]?decryptReturnByte(Key?keybyte[]?text){
?????try{
?????????Cipher?cipher=Cipher.getInstance(“Blowfish/ECB/PKCS5Padding“);
?????????cipher.init(Cipher.DECRYPT_MODEkey);
?????????return?cipher.doFinal(text);
?????}catch(Exception?e){??return?null;}
???}
/**
?*?使用PBE保管Blowfish密碼
?*?@param?Key?targetKey:?Blowfish密碼
?*?@param?char[]?password:?口令
?*?@return?Vector-element1:byte[]:密文-element2:byte[]:鹽
?*/

????public?static?Vector?wrapKey(Key?targetKeychar[]?password){
???????try{
??????????PBEKeySpec?keySpec=new?PBEKeySpec(password);
??????????SecretKeyFactory?keyFactory=SecretKeyFactory.getInstance(“PBEWithMD5AndDES“);
??????????SecretKey?key=keyFactory.generateSecret(keySpec);
??????????Cipher?cipher=Cipher.getInstance(“PBEWithMD5AndDES“);
??????????byte[]?salt=new?byte[8];
??????????Random?random=new?Random();
??????????random.nextBytes(salt);
??????????PBEParameterSpec?paramSpec=new?PBEParameterSpec(salt100);
??????????cipher.init(cipher.WRAP_MODEkeyparamSpec);
??????????Vector?encryptedKey=new?Vector();
??????????encryptedKey.addElement(cipher.wrap(targetKey));
??????????encryptedKey.addElement(salt);
??????????return?encryptedKey;
???????}catch(Exception?e){e.printStackTrace();
??????????return?null;
????????}
????}
/**
?*?取出PBE加密的密鑰
?*?@param?Vector?encryptedKey-element1:byte[]:密文-element2:byte[]:鹽
?*?@param?char[]?password:口令
?*?@return?Key:Blowfish密碼
?*/
??public?static?Key?unwrapKey(Vector?encryptedKeychar[]?password){
??????try{

??????????byte[]?wrapedKey=(byte[])encryptedKey.elementAt(0);
??????????byte[]?salt=(byte[])encryptedKey.elementAt(1);
??????????PBEKeySpec?keySpec=new?PBEKeySpec(password);
??????????SecretKeyFactory?keyFactory=SecretKeyFactory.getInstance(“PBEWithMD5AndDES“);
??????????SecretKey?key=keyFactory.generateSecret(keySpec);
??????????Cipher?cipher=Cipher.getInstance(“PBEWithMD5AndDES“);
??????????PBEParameterSpec?paramSpec=new?PBEParameterSpec(salt100);
??????????ciph

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2006-01-04?17:55??jct\
?????文件????????5047??2006-01-04?20:59??jct\RSATool.java
?????文件????????2015??2006-01-04?20:59??jct\Digest.java
?????文件????????4078??2006-01-04?20:59??jct\BlowfishTool.java
?????文件????????4672??2006-01-04?20:59??jct\PBETool.java
?????文件?????????616??2006-01-04?21:28??jct\_Readme.java

評論

共有 條評論

相關資源