本文整理汇总了Java中com.subgraph.orchid.crypto.TorPublicKey类的典型用法代码示例。如果您正苦于以下问题:Java TorPublicKey类的具体用法?Java TorPublicKey怎么用?Java TorPublicKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TorPublicKey类属于com.subgraph.orchid.crypto包,在下文中一共展示了TorPublicKey类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: verifySignatureForTrustedAuthority
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
private SignatureStatus verifySignatureForTrustedAuthority(DirectoryServer trustedAuthority, DirectorySignature signature) {
final KeyCertificate certificate = trustedAuthority.getCertificateByFingerprint(signature.getSigningKeyDigest());
if(certificate == null) {
logger.fine("Missing certificate for signing key: "+ signature.getSigningKeyDigest());
addRequiredCertificateForSignature(signature);
return SignatureStatus.STATUS_NEED_CERTS;
}
if(certificate.isExpired()) {
return SignatureStatus.STATUS_FAILED;
}
final TorPublicKey signingKey = certificate.getAuthoritySigningKey();
final HexDigest d = (signature.useSha256()) ? signingHash256 : signingHash;
if(!signingKey.verifySignature(signature.getSignature(), d)) {
logger.warning("Signature failed on consensus for signing key: "+ signature.getSigningKeyDigest());
return SignatureStatus.STATUS_FAILED;
}
return SignatureStatus.STATUS_VERIFIED;
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:ConsensusDocumentImpl.java
示例2: sendIntroduce
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
boolean sendIntroduce(TorPublicKey permanentKey, byte[] publicKeyBytes, byte[] rendezvousCookie, Router rendezvousRouter) {
final RelayCell introduceCell = introductionCircuit.createRelayCell(RelayCell.RELAY_COMMAND_INTRODUCE1, 0, introductionCircuit.getFinalCircuitNode());
final byte[] payload = createIntroductionPayload(rendezvousRouter, publicKeyBytes, rendezvousCookie, permanentKey);
final TorPublicKey serviceKey = introductionPoint.getServiceKey();
introduceCell.putByteArray(serviceKey.getFingerprint().getRawBytes());
introduceCell.putByteArray(payload);
introductionCircuit.sendRelayCell(introduceCell);
final RelayCell response = introductionCircuit.receiveRelayCell();
if(response == null) {
logger.fine("Timeout waiting for response to INTRODUCE1 cell");
return false;
} else if(response.getRelayCommand() != RelayCell.RELAY_COMMAND_INTRODUCE_ACK) {
logger.info("Unexpected relay cell type received waiting for response to INTRODUCE1 cell: "+ response.getRelayCommand());
return false;
} else if(response.cellBytesRemaining() == 0) {
return true;
} else {
logger.info("INTRODUCE_ACK indicates that introduction was not forwarded: "+ response.getByte());
return false;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:24,代码来源:IntroductionProcessor.java
示例3: verifyIdentityKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
protected void verifyIdentityKey(PublicKey publicKey) throws ConnectionHandshakeException {
if(!(publicKey instanceof RSAPublicKey)) {
throw new ConnectionHandshakeException("Identity certificate public key is not an RSA key as expected");
}
final TorPublicKey identityKey = new TorPublicKey((RSAPublicKey)publicKey);
final Router router = connection.getRouter();
if((router instanceof BridgeRouter) && (router.getIdentityHash() == null)) {
logger.info("Setting Bridge fingerprint from connection handshake for "+ router);
((BridgeRouter) router).setIdentity(identityKey.getFingerprint());
} else if(!identityKey.getFingerprint().equals(router.getIdentityHash())) {
throw new ConnectionHandshakeException("Router identity does not match certificate key");
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:ConnectionHandshake.java
示例4: getIdentityKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public TorPublicKey getIdentityKey() {
final RouterDescriptor rd = downcastDescriptor();
if(rd != null) {
return rd.getIdentityKey();
} else {
return null;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:RouterImpl.java
示例5: getOnionKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public TorPublicKey getOnionKey() {
refreshDescriptor();
if(descriptor != null) {
return descriptor.getOnionKey();
} else {
return null;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:RouterImpl.java
示例6: getOnionKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public TorPublicKey getOnionKey() {
if(descriptor != null) {
return descriptor.getOnionKey();
} else {
return null;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:BridgeRouterImpl.java
示例7: encryptIntroductionBuffer
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
private byte[] encryptIntroductionBuffer(ByteBuffer buffer, TorPublicKey key) {
final int len = buffer.position();
final byte[] payload = new byte[len];
buffer.flip();
buffer.get(payload);
final HybridEncryption enc = new HybridEncryption();
return enc.encrypt(payload, key);
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:IntroductionProcessor.java
示例8: getAuthorityIdentityKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public TorPublicKey getAuthorityIdentityKey() {
return identityKey;
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:4,代码来源:KeyCertificateImpl.java
示例9: getAuthoritySigningKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public TorPublicKey getAuthoritySigningKey() {
return signingKey;
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:4,代码来源:KeyCertificateImpl.java
示例10: verifyCrossSignature
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
private void verifyCrossSignature(TorSignature crossSignature) {
TorPublicKey identityKey = currentCertificate.getAuthorityIdentityKey();
TorPublicKey signingKey = currentCertificate.getAuthoritySigningKey();
if(!signingKey.verifySignature(crossSignature, identityKey.getFingerprint()))
throw new TorParsingException("Cross signature on certificate failed.");
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:7,代码来源:KeyCertificateParser.java
示例11: parsePublicKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public TorPublicKey parsePublicKey() {
final DocumentObject documentObject = parseObject();
return TorPublicKey.createFromPEMBuffer(documentObject.getContent());
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:5,代码来源:DocumentFieldParserImpl.java
示例12: verifySignedEntity
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public boolean verifySignedEntity(TorPublicKey publicKey, TorSignature signature) {
isProcessingSignedEntity = false;
return publicKey.verifySignature(signature, signatureDigest);
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:5,代码来源:DocumentFieldParserImpl.java
示例13: setOnionKey
import com.subgraph.orchid.crypto.TorPublicKey; //导入依赖的package包/类
public void setOnionKey(TorPublicKey onionKey) {
this.onionKey = onionKey;
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:4,代码来源:RouterMicrodescriptorImpl.java
注:本文中的com.subgraph.orchid.crypto.TorPublicKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论