Source:
private void doSignMessage(final UnsignedOslpEnvelopeDto unsignedOslpEnvelopeDto, final String correlationUid, final String deviceIdentification, final Destination replyToQueue) { final byte[] deviceId = unsignedOslpEnvelopeDto.getDeviceId(); final byte[] sequenceNumber = unsignedOslpEnvelopeDto.getSequenceNumber(); final Message payloadMessage = unsignedOslpEnvelopeDto.getPayloadMessage(); final String organisationIdentification = unsignedOslpEnvelopeDto.getOrganisationIdentification(); final int messagePriority = unsignedOslpEnvelopeDto.getMessagePriority(); final OslpEnvelope oslpEnvelope = new OslpEnvelope.Builder().withDeviceId(deviceId) .withSequenceNumber(sequenceNumber).withPrimaryKey(this.privateKey).withSignature(this.signature) .withProvider(this.signatureProvider).withPayloadMessage(payloadMessage).build(); ResponseMessage responseMessage; responseMessage = null; if (oslpEnvelope == null) { LOGGER.error("Message for device: with correlationId: NOT SIGNED, sending error to protocol-adapter", deviceIdentification, correlationUid); responseMessage = ResponseMessage.newResponseMessageBuilder().withCorrelationUid(correlationUid) .withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException( new OsgpException(ComponentType.UNKNOWN, "Failed to build signed OslpEnvelope", null)) .withDataObject(unsignedOslpEnvelopeDto).withMessagePriority(messagePriority).build(); } else { LOGGER.info("Message for device: with correlationId: signed, sending response to protocol-adapter", deviceIdentification, correlationUid); final SignedOslpEnvelopeDto signedOslpEnvelopeDto = new SignedOslpEnvelopeDto(oslpEnvelope, unsignedOslpEnvelopeDto); responseMessage = ResponseMessage.newResponseMessageBuilder().withCorrelationUid(correlationUid) .withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.OK) .withDataObject(signedOslpEnvelopeDto).withMessagePriority(messagePriority).build(); } this.signingServerResponseMessageSender.send(responseMessage, "SIGNING_RESPONSE", replyToQueue); }

Target:
private void doSignMessage(final UnsignedOslpEnvelopeDto unsignedOslpEnvelopeDto, final String correlationUid, final String deviceIdentification, final Destination replyToQueue) { final byte[] deviceId = unsignedOslpEnvelopeDto.getDeviceId(); final byte[] sequenceNumber = unsignedOslpEnvelopeDto.getSequenceNumber(); final Message payloadMessage = unsignedOslpEnvelopeDto.getPayloadMessage(); final String organisationIdentification = unsignedOslpEnvelopeDto.getOrganisationIdentification(); final int messagePriority = unsignedOslpEnvelopeDto.getMessagePriority(); final OslpEnvelope oslpEnvelope = new OslpEnvelope.Builder().withDeviceId(deviceId) .withSequenceNumber(sequenceNumber).withPrimaryKey(this.privateKey).withSignature(this.signature) .withProvider(this.signatureProvider).withPayloadMessage(payloadMessage).build(); ResponseMessage responseMessage; if (oslpEnvelope == null) { LOGGER.error("Message for device: with correlationId: NOT SIGNED, sending error to protocol-adapter", deviceIdentification, correlationUid); responseMessage = ResponseMessage.newResponseMessageBuilder().withCorrelationUid(correlationUid) .withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException( new OsgpException(ComponentType.UNKNOWN, "Failed to build signed OslpEnvelope", null)) .withDataObject(unsignedOslpEnvelopeDto).withMessagePriority(messagePriority).build(); } else { LOGGER.info("Message for device: with correlationId: signed, sending response to protocol-adapter", deviceIdentification, correlationUid); final SignedOslpEnvelopeDto signedOslpEnvelopeDto = new SignedOslpEnvelopeDto(oslpEnvelope, unsignedOslpEnvelopeDto); responseMessage = ResponseMessage.newResponseMessageBuilder().withCorrelationUid(correlationUid) .withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.OK) .withDataObject(signedOslpEnvelopeDto).withMessagePriority(messagePriority).build(); } this.signingServerResponseMessageSender.send(responseMessage, "SIGNING_RESPONSE", replyToQueue); }