use of org.hyperledger.fabric.protos.common.Configtx.ConfigUpdateEnvelope in project fabric-sdk-java by hyperledger.
the class Channel method getChannelConfigurationSignature.
byte[] getChannelConfigurationSignature(ChannelConfiguration channelConfiguration, User signer) throws InvalidArgumentException {
userContextCheck(signer);
if (null == channelConfiguration) {
throw new InvalidArgumentException("channelConfiguration is null");
}
try {
Envelope ccEnvelope = Envelope.parseFrom(channelConfiguration.getChannelConfigurationAsBytes());
final Payload ccPayload = Payload.parseFrom(ccEnvelope.getPayload());
TransactionContext transactionContext = getTransactionContext(signer);
final ConfigUpdateEnvelope configUpdateEnv = ConfigUpdateEnvelope.parseFrom(ccPayload.getData());
final ByteString configUpdate = configUpdateEnv.getConfigUpdate();
ByteString sigHeaderByteString = getSignatureHeaderAsByteString(signer, transactionContext);
ByteString signatureByteSting = transactionContext.signByteStrings(new User[] { signer }, sigHeaderByteString, configUpdate)[0];
return ConfigSignature.newBuilder().setSignatureHeader(sigHeaderByteString).setSignature(signatureByteSting).build().toByteArray();
} catch (Exception e) {
throw new InvalidArgumentException(e);
} finally {
logger.debug("finally done");
}
}
Aggregations