• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TorMessageDigest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.subgraph.orchid.crypto.TorMessageDigest的典型用法代码示例。如果您正苦于以下问题:Java TorMessageDigest类的具体用法?Java TorMessageDigest怎么用?Java TorMessageDigest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TorMessageDigest类属于com.subgraph.orchid.crypto包,在下文中一共展示了TorMessageDigest类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processSignature

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private void processSignature() {
	if(!seenFirstSignature) {
		doFirstSignature();
	}
	final String s = fieldParser.parseString();
	final HexDigest identity;
	boolean useSha256 = false;
	if(s.length() < TorMessageDigest.TOR_DIGEST_SIZE) {
		useSha256 = ("sha256".equals(s));
		identity = fieldParser.parseHexDigest();
	} else {
		identity = HexDigest.createFromString(s);
	}
	HexDigest signingKey = fieldParser.parseHexDigest();
	TorSignature signature = fieldParser.parseSignature();
	document.addSignature(new DirectorySignature(identity, signingKey, signature, useSha256));
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:18,代码来源:FooterSectionParser.java


示例2: CircuitNodeCryptoState

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private CircuitNodeCryptoState(byte[] keyMaterial, byte[] verifyDigest) {
	checksumDigest = HexDigest.createFromDigestBytes(verifyDigest);
	int offset = 0;
	
	forwardDigest = new TorMessageDigest();
	forwardDigest.update(extractDigestBytes(keyMaterial, offset));
	offset += TorMessageDigest.TOR_DIGEST_SIZE;

	backwardDigest = new TorMessageDigest();
	backwardDigest.update(extractDigestBytes(keyMaterial, offset));
	offset += TorMessageDigest.TOR_DIGEST_SIZE;
	
	forwardCipher = TorStreamCipher.createFromKeyBytes(extractCipherKey(keyMaterial, offset));
	offset += TorStreamCipher.KEY_LEN;
	
	backwardCipher = TorStreamCipher.createFromKeyBytes(extractCipherKey(keyMaterial, offset));
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:18,代码来源:CircuitNodeCryptoState.java


示例3: processRendezvous2

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
HiddenServiceCircuit processRendezvous2(TorTapKeyAgreement kex) {
	final RelayCell cell = circuit.receiveRelayCell();
	if(cell == null) {
		logger.info("Timeout waiting for RENDEZVOUS2");
		return null;
	} else if (cell.getRelayCommand() != RelayCell.RELAY_COMMAND_RENDEZVOUS2) {
		logger.info("Unexpected Relay cell type received while waiting for RENDEZVOUS2: "+ cell.getRelayCommand());
		return null;
	}
	final BigInteger peerPublic = readPeerPublic(cell);
	final HexDigest handshakeDigest = readHandshakeDigest(cell);
	if(peerPublic == null || handshakeDigest == null) {
		return null;
	}
	final byte[] verifyHash = new byte[TorMessageDigest.TOR_DIGEST_SIZE];
	final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE];
	if(!kex.deriveKeysFromDHPublicAndHash(peerPublic, handshakeDigest.getRawBytes(), keyMaterial, verifyHash)) {
		logger.info("Error deriving session keys while extending to hidden service");
		return null;
	}
	return circuit.connectHiddenService(CircuitNodeImpl.createAnonymous(circuit.getFinalCircuitNode(), keyMaterial, verifyHash));
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:23,代码来源:RendezvousProcessor.java


示例4: HexDigest

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private HexDigest(byte[] data) {
	if(data.length != TorMessageDigest.TOR_DIGEST_SIZE && data.length != TorMessageDigest.TOR_DIGEST256_SIZE) {
		throw new TorException("Digest data is not the correct length "+ data.length +" != (" + TorMessageDigest.TOR_DIGEST_SIZE + " or "+ TorMessageDigest.TOR_DIGEST256_SIZE +")");
	}
	digestBytes = new byte[data.length];
	isDigest256 = digestBytes.length == TorMessageDigest.TOR_DIGEST256_SIZE;
	System.arraycopy(data, 0, digestBytes, 0, data.length);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:HexDigest.java


示例5: parseMicrodescriptorHash

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private void parseMicrodescriptorHash() {
	if(document.getFlavor() != ConsensusFlavor.MICRODESC) {
		throw new TorParsingException("'m' line is invalid unless consensus flavor is microdesc");
	}
	final byte[] hashBytes = fieldParser.parseBase64Data();
	if(hashBytes.length != TorMessageDigest.TOR_DIGEST256_SIZE) {
		throw new TorParsingException("'m' line has incorrect digest size "+ hashBytes.length +" != "+ TorMessageDigest.TOR_DIGEST256_SIZE);
	}
	currentEntry.setMicrodescriptorDigest(HexDigest.createFromDigestBytes(hashBytes));
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:11,代码来源:RouterStatusSectionParser.java


示例6: doFirstSignature

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private void doFirstSignature() {
	seenFirstSignature = true;
	fieldParser.endSignedEntity();
	final TorMessageDigest messageDigest = fieldParser.getSignatureMessageDigest();
	messageDigest.update("directory-signature ");
	document.setSigningHash(messageDigest.getHexDigest());
	
	TorMessageDigest messageDigest256 = fieldParser.getSignatureMessageDigest256();
	messageDigest256.update("directory-signature ");
	document.setSigningHash256(messageDigest256.getHexDigest());
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:12,代码来源:FooterSectionParser.java


示例7: finalizeDescriptor

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private void finalizeDescriptor(RouterMicrodescriptorImpl descriptor) {
	final TorMessageDigest digest = new TorMessageDigest(true);
	digest.update(descriptor.getRawDocumentData());
	descriptor.setDescriptorDigest(digest.getHexDigest());
	if(!descriptor.isValidDocument()) {
		resultHandler.documentInvalid(descriptor, "Microdescriptor data invalid");
	} else {
		resultHandler.documentParsed(descriptor);
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:11,代码来源:RouterMicrodescriptorParser.java


示例8: processPayload

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private CircuitNode processPayload(byte[] payload) {
	final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE];
	final byte[] verifyDigest = new byte[TorMessageDigest.TOR_DIGEST_SIZE];
	if(!kex.deriveKeysFromHandshakeResponse(payload, keyMaterial, verifyDigest)) {
		return null;
	}
	return extender.createNewNode(router, keyMaterial, verifyDigest);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:NTorCircuitExtender.java


示例9: processCreatedFastCell

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private CircuitNode processCreatedFastCell(Router targetRouter, Cell cell, TorKeyAgreement kex) {
	final byte[] payload = new byte[TorMessageDigest.TOR_DIGEST_SIZE * 2];
	final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE];
	final byte[] verifyHash = new byte[TorMessageDigest.TOR_DIGEST_SIZE];
	cell.getByteArray(payload);
	if(!kex.deriveKeysFromHandshakeResponse(payload, keyMaterial, verifyHash)) {
		// XXX
		return null;
	}
	final CircuitNode node = CircuitNodeImpl.createFirstHop(targetRouter, keyMaterial, verifyHash);
	circuit.appendNode(node);
	return node;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:CircuitExtender.java


示例10: processExtendResponse

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private CircuitNode processExtendResponse(RelayCell response) {
	final byte[] handshakeResponse = new byte[TorTapKeyAgreement.DH_LEN + TorMessageDigest.TOR_DIGEST_SIZE];
	response.getByteArray(handshakeResponse);
	
	final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE];
	final byte[] verifyDigest = new byte[TorMessageDigest.TOR_DIGEST_SIZE];
	if(!kex.deriveKeysFromHandshakeResponse(handshakeResponse, keyMaterial, verifyDigest)) {
		return null;
	}
	return extender.createNewNode(router, keyMaterial, verifyDigest);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:12,代码来源:TapCircuitExtender.java


示例11: generateAuthId

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
private byte[] generateAuthId(byte[] iv) {
	final TorMessageDigest md = new TorMessageDigest();
	md.update(cookie.getValue());
	md.update(iv);
	final byte[] digest = md.getDigestBytes();
	final byte[] id = new byte[BASIC_ID_LENGTH];
	System.arraycopy(digest, 0, id, 0, BASIC_ID_LENGTH);
	return id;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:10,代码来源:HSAuthentication.java


示例12: getCurrentSecretId

import com.subgraph.orchid.crypto.TorMessageDigest; //导入依赖的package包/类
byte[] getCurrentSecretId(int replica) {
	final TorMessageDigest digest = new TorMessageDigest();
	digest.update(getCurrentTimePeriod());
	final HSDescriptorCookie cookie = getAuthenticationCookie();
	if(cookie != null && cookie.getType() == CookieType.COOKIE_STEALTH) {
		digest.update(cookie.getValue());
	}
	digest.update(new byte[] { (byte) replica });
	return digest.getDigestBytes();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:11,代码来源:HiddenService.java



注:本文中的com.subgraph.orchid.crypto.TorMessageDigest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigurationProperty类代码示例发布时间:2022-05-23
下一篇:
Java PermissionUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap