IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
 View Only
Expand all | Collapse all

OPEN SSL conversion to binary format on AS400 (IBM i / iSeries / System i)

  • 1.  OPEN SSL conversion to binary format on AS400 (IBM i / iSeries / System i)

    Posted Tue January 02, 2024 01:49 PM

    Hello,

    We are facing problems with the translation of hex to binary via open ssl.

    When we use the qsh command

    > echo "testmessage" | openssl dgst -binary -sha256

    then there is no result.

    When we use the command without the binary option)

    > echo "testmessage" | openssl dgst -sha256  

    then we get a response. So the conversion to binary does not work. That conversion is needed for the call of an external Api.

    We are on OS 7.5, we use version 1.1.1. N of open ssl.

    Anyone knows what we can do to make it work?

    On another system (also on OS 7.5) it does work! 

    Thanks for any suggestions.

    Ed



    ------------------------------
    Ed Steures
    ------------------------------


  • 2.  RE: OPEN SSL conversion to binary format on AS400 (IBM i / iSeries / System i)

    Posted Tue January 02, 2024 03:22 PM
    Edited by Jack Woehr Tue January 02, 2024 03:24 PM

    "Doctor, it hurts when I do this."
    "Don't do that!"

    Your example works in PASE.

    $ echo "testmessage" | openssl dgst -binary -sha256
    4}���~FY���O�~bj�4\n�Z�&\�
    $ echo "testmessage" | openssl dgst -sha256  
    SHA2-256(stdin)= 34070729087df0bb18ae8e7e4659a4f58e4fe57e626a8e345c6ec85aae265cf0

    Stay away from QSH.

    If you have to call PASE from a CL or other ILE program, use @Richard Schoen's open source QshOni.

    ------------------------------
    Jack Woehr
    IBM Champion 2021 - 2023
    IBM Qiskit Advocate
    ------------------------------