ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Build XML string signature in RPGLE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Build XML string signature in RPGLE

    Hi All,

    I want to ask how to create string signature in Triple Des PKCS #5 padding algorithm which the value will be sent via XML to other side.
    They give us example value like this :
    Key = Th1s_0nLy_F0uR_t3sT1nG__
    Data = 094255123456|654321|outlet_1
    Signature value result = y/w+MA6QjY3KUQ3bf43eiqkyluhgWfnCpr3N1ejh8Co=

    I've tried using Qc3EncryptData, but got different result.

    Here the code :
    DQc3EncryptData...
    D PR ExtProc('Qc3EncryptData')
    D ClrData * value
    D ClrDataL 10i 0 const
    D ClrDataFmtN 8a const
    D AlgoDes 16a const
    D AlgoFmt 8a const
    D KeyDes 16a const
    D KeyFmt 8a const
    D CryptoSP 1a const
    D CryptoDev 10a const
    D EncData 64a options(*varsize:*omit)
    D EncDataAreaL 10i 0 const options(*omit)
    D EncDataL 10i 0 options(*omit)
    D ErrCode 100a options(*omit)
    *
    D algd0200_t DS qualified
    D algorithm 10i 0
    D blockLen 10i 0
    D mode 1a
    D padOption 1a
    D padChar 1a
    D reserved_1 1a
    D macLen 10i 0
    D keySize 10i 0
    D initVector 32a
    *
    D algd0200 DS likeds(algd0200_t) inz
    *
    D keyd0200_t DS qualified
    D type 10i 0
    D length 10i 0
    D format 1a
    D reserved_1 3a
    D value 24a
    *
    D keyd0200 DS likeds(keyd0200_t) inz

    /free
    data='094255123456|654321|outlet_1';
    datakey='Th1s_0nLy_F0uR_t3sT1nG__';
    algd0200=*allx'00';
    algd0200.algorithm = 21;
    algd0200.blockLen = 8;
    algd0200.mode = '1';
    algd0200.padOption = '2';
    algd0200.padChar = x'00';
    algd0200.reserved_1 = *ALLx'00';
    algd0200.macLen = 0;
    algd0200.keySize = 0;
    algd0200.initVector = 'outlet_1';

    keyd0200.type = 21;
    keyd0200.length = 24;
    keyd0200.format = '0';
    keyd0200.reserved_1 = *ALLx'00';
    keyd0200.value = dataKey;

    Qc3EncryptData( %addr(data)
    :44
    :'DATA0100'
    :algd0200
    :'ALGD0200'
    :keyd0200
    :'KEYD0200'
    :'0'
    :''
    :tmpEncrypted
    :%size(tmpEncrypted)
    :encryptedLen
    :ErrorData );



    Thanks and Regards

  • #2
    Already found the solution...
    Thanks All

    Comment

    Working...
    X