Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckSumPipe output turns into string data which results in faulty Base64Encoded output #7047

Closed
Thermalight opened this issue Jun 21, 2024 · 2 comments · Fixed by #7456
Closed
Assignees
Labels
Milestone

Comments

@Thermalight
Copy link
Contributor

Is your Frank! up to date?

8.2.0-20240621.042325

Current Behavior

The checksumpipe hashes input and returns a hexadecimal string.
When this string is converted to base64 with the Base64Pipe, the result is calculated using character encoding instead of the hexadecimal value of the hexstring.

Expected Behavior

I want the Base64Pipe to convert from hexadecimal to base64 when a hexstring is provided, or be able to retrieve a bas64 encoded version after hashing.

Environment Information

FF! 8.1.0-RC2-20240508.012135: frank2openbanking
Running on DESKTOP-1R1U3IC using Apache Tomcat/9.0.88
Java Version: OpenJDK Runtime Environment (21.0.2+13-LTS)
Heap size: 151M, total JVM memory: 236M
Free disk space: 59GB, total disk space: 350GB
Up since: 2024-06-21 09:16:00 (19m)

Steps To Reproduce

Create an adapter with the following pipes:

Configuration

<Adapter name="HexToB64">
  <Receiver name="HexToB64Receiver">
    <ApiListener uriPattern="b64" name="HexToB64Listener" />
  </Receiver>
  <Pipeline>
    <Exits>
      <Exit name="Success" state="SUCCESS" />
      <Exit name="Error" state="ERROR" />
    </Exits>

    <!-- Hash Hello World with the sha256 algorithm  -->
    <ChecksumPipe name="CreateHexString" getInputFromFixedValue="Hello World!" type="SHA256" />
    <!-- Convert the hexstring to base64 -->
    <Base64Pipe name="ConvertHexToB64" />

  </Pipeline>
</Adapter>

Input

No response

What database are you using?

No response

What browsers are you seeing the problem on?

Chrome

Relevant Log Output

No response

Anything else?

No response

@nielsm5
Copy link
Member

nielsm5 commented Jun 24, 2024

Related #6622. I think we should (somehow) merge the 2 pipes first, and see how we can create a proper, uniform pipe-output.

@nielsm5 nielsm5 changed the title Hexstring to Base64 CheckSumPipe output turns into string data which results in faulty Base64Encoded output Jun 24, 2024
@nielsm5 nielsm5 added this to the 8.3 milestone Jun 24, 2024
@evandongen evandongen moved this to In Progress in Frank!Framework Sep 5, 2024
@evandongen
Copy link
Contributor

evandongen commented Sep 5, 2024

ChecksumPipe is capable of generating a 'hash' of a given message (file or string) using an algorithm. With this, you can prove integrity of the message.
HashPipe uses Mac implementations of algorithms. A Mac algorithm uses a secret, combined with the algorithm to create a 'hash' of a message. Only sources which have this secret are able to generate the same hash for the given message. With this, you can prove integrity and authenticity of a message.

update
With this in mind we decided we want to keep these two implementations and want to extend the ChecksumPipe with a parameter to control the output format (Hex/Base64). The HashPipe already has this option.

Other todo's:

  • Clear documentation on when and how to use them, preferably with examples, needs to be added to both classes.
  • Refactor the naming of parameters inner classes in ChecksumPipe to be clear (eg: ChecksumType should probably be something like 'AlgorithmType`).
  • Add unit tests to ChecksumPipeTest for the new output type parameter

Also see: https://stackoverflow.com/a/3696947/956884

@evandongen evandongen moved this from In Progress to Review in Frank!Framework Sep 9, 2024
@evandongen evandongen linked a pull request Sep 9, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from Review to Done in Frank!Framework Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants