use of com.jd.blockchain.transaction.DigitalSignatureBlob in project jdchain-core by blockchain-jd-com.
the class LedgerTransactionDataTest method initTxRequestMessage.
private TxRequestMessage initTxRequestMessage(CryptoAlgorithm hashAlgorithm) throws Exception {
TransactionContent txContent = initTransactionContent();
HashDigest txHash = TxBuilder.computeTxContentHash(hashAlgorithm, txContent);
TxRequestMessage txRequestMessage = new TxRequestMessage(txHash, txContent);
AsymmetricKeypair keypair2 = ClassicCryptoService.ED25519.generateKeypair();
SignatureDigest digest1 = ClassicCryptoService.ED25519.sign(keypair.getPrivKey(), "zhangsan".getBytes());
SignatureDigest digest2 = ClassicCryptoService.ED25519.sign(keypair.getPrivKey(), "lisi".getBytes());
DigitalSignatureBlob endPoint1 = new DigitalSignatureBlob(keypair.getPubKey(), digest1);
DigitalSignatureBlob endPoint2 = new DigitalSignatureBlob(keypair2.getPubKey(), digest2);
txRequestMessage.addEndpointSignatures(endPoint1);
txRequestMessage.addEndpointSignatures(endPoint2);
AsymmetricKeypair keypair4 = ClassicCryptoService.ED25519.generateKeypair();
SignatureDigest digest3 = ClassicCryptoService.ED25519.sign(keypair.getPrivKey(), "wangwu".getBytes());
SignatureDigest digest4 = ClassicCryptoService.ED25519.sign(keypair4.getPrivKey(), "zhaoliu".getBytes());
DigitalSignatureBlob node1 = new DigitalSignatureBlob(keypair.getPubKey(), digest3);
DigitalSignatureBlob node2 = new DigitalSignatureBlob(keypair4.getPubKey(), digest4);
txRequestMessage.addNodeSignatures(node1);
txRequestMessage.addNodeSignatures(node2);
return txRequestMessage;
}
use of com.jd.blockchain.transaction.DigitalSignatureBlob in project jdchain-core by blockchain-jd-com.
the class LedgerInitializeWebController method getNodesSignatures.
private DigitalSignature[] getNodesSignatures() {
ParticipantNode[] parties = this.ledgerInitConfig.getParticipants();
List<DigitalSignature> signatures = new ArrayList<>();
for (int i = 0; i < parties.length; i++) {
if (parties[i].getParticipantNodeState() != ParticipantNodeState.CONSENSUS) {
continue;
}
PubKey pubKey = parties[i].getPubKey();
SignatureDigest signDigest = this.permissions[i].getTransactionSignature();
signatures.add(new DigitalSignatureBlob(pubKey, signDigest));
}
return signatures.toArray(new DigitalSignature[signatures.size()]);
}
Aggregations