⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java.txt

📁 这个模块是IBE算法的核心。主要是系统参数、主密钥的计算。
💻 TXT
字号:
public class PKG {
		public static MessageDigest hash = null;
		public static BilinearMap map = new ModifiedTatePairing();
		//系统参数
		public static IbeSystemParameters systemParameters = null;	//加解密时要用到!用于//cipher的init
		int bitLength = 0;
		public static BigInteger masterKey = null;
		
		/*
		 * 初始化。包括:
		 * 密钥发生器、消息摘要、双线性映射、主密钥、系统参数
		 */
		public PKG() throws FileNotFoundException, IOException{
			//初始化message digest to be used
			try {
				hash = MessageDigest.getInstance( "MD5" );
				
			} catch ( NoSuchAlgorithmException nsae ) {
				// TODO: handle exception
				nsae.printStackTrace();
			}
				initialize();
			
			//系统参数
			systemParameters = new IbeSystemParameters( map, hash, masterKey );
		}
	
		public void initialize(){
			//双线性映射map
			boolean fieldTooSmall = false;
			do{
				fieldTooSmall = false;
				//get a count of the maximum possible number of points that we could use,
				//i.e. p / kappa where p is the upper limit of 有限域Fp
				BigInteger maxPts = 
					map.getCurve().getField().getChar().divide( map.getCurve().getKappa() );

				bitLength = maxPts.bitLength();
				int bytes = bitLength / 8;	//字节数
				if( bytes < hash.getDigestLength() ){	//p is too small, repeat...
					map = new ModifiedTatePairing();
					fieldTooSmall = true;
				}
			}while( fieldTooSmall );
			
			//主密钥生成
			masterKey = new BigInteger( map.getQ().bitLength()-1, new SecureRandom() );
		}
		…………
}
9.2.3.	密钥申请模块

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -