當前位置: 首頁>>代碼示例>>Java>>正文


Java ZipParameters.getAesKeyStrength方法代碼示例

本文整理匯總了Java中net.lingala.zip4j.model.ZipParameters.getAesKeyStrength方法的典型用法代碼示例。如果您正苦於以下問題:Java ZipParameters.getAesKeyStrength方法的具體用法?Java ZipParameters.getAesKeyStrength怎麽用?Java ZipParameters.getAesKeyStrength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.lingala.zip4j.model.ZipParameters的用法示例。


在下文中一共展示了ZipParameters.getAesKeyStrength方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateAESExtraDataRecord

import net.lingala.zip4j.model.ZipParameters; //導入方法依賴的package包/類
private AESExtraDataRecord generateAESExtraDataRecord(ZipParameters parameters) throws ZipException {
	
	if (parameters == null) {
		throw new ZipException("zip parameters are null, cannot generate AES Extra Data record");
	}
	
	AESExtraDataRecord aesDataRecord = new AESExtraDataRecord();
	aesDataRecord.setSignature(InternalZipConstants.AESSIG);
	aesDataRecord.setDataSize(7);
	aesDataRecord.setVendorID("AE");
	// Always set the version number to 2 as we do not store CRC for any AES encrypted files
	// only MAC is stored and as per the specification, if version number is 2, then MAC is read
	// and CRC is ignored
	aesDataRecord.setVersionNumber(2); 
	if (parameters.getAesKeyStrength() == Zip4jConstants.AES_STRENGTH_128) {
		aesDataRecord.setAesStrength(Zip4jConstants.AES_STRENGTH_128);
	} else if (parameters.getAesKeyStrength() == Zip4jConstants.AES_STRENGTH_256) {
		aesDataRecord.setAesStrength(Zip4jConstants.AES_STRENGTH_256);
	} else {
		throw new ZipException("invalid AES key strength, cannot generate AES Extra data record");
	}
	aesDataRecord.setCompressionMethod(parameters.getCompressionMethod());
	
	return aesDataRecord;
}
 
開發者ID:joielechong,項目名稱:Zip4jAndroid,代碼行數:26,代碼來源:CipherOutputStream.java


注:本文中的net.lingala.zip4j.model.ZipParameters.getAesKeyStrength方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。