× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I did find one translation issue and am now getting CPF9DCE "A data length
is not valid". This is a pretty vague message.

Given the data I'm passing I think I am passing the correct lengths. This
makes me think I may be passing some wrong data so the error means "not
expected" more than "wrong for the data passed" so I need to verify some
assumptions I made about the parameters.

If you see anything that I'm doing wrong please let me know.


Parm 1 - Signature - The actual JWT
Parm 2 - Length of parm 1
Parm 3 - Input Data - The decoded header and payload from the JWT
Parm 4 - Length of parm 3
Parm 5 - 'DATA0100'
Parm 6 - ALGD0400 structure
DCL-DS ALGD0400;
Algorithm INT(10) INZ(50);
BlockFormat CHAR(1) INZ('1');
Reserved CHAR(3) INZ(*LOVAL);
SigningAlgo INT(10) INZ(3);
END-DS;
Parm 7 - 'ALGD0400'
Parm 8 - KEYD0600 structure
DCL-DS KEYD0600;
PEMLength INT(10) INZ(0);
PEMReserved CHAR(4) INZ(*LOVAL);
PEMCertificate CHAR(8000) CCSID(*HEX);
END-DS;
Parm 9 - 'KEYD0600'
Parm 10 - '1'
Parm 11 - ' '
Parm 12 - standard error DS


Prototype:
DCL-PR VerifySignature EXTPROC('Qc3VerifySignature');
Signature POINTER VALUE;
SignatureLen INT(10) CONST;
InputData POINTER VALUE;
InputDataLen INT(10) CONST;
InputDataFormat CHAR(8) CONST;
AlgorithmDesc POINTER VALUE;
AlgorithmDescFormat CHAR(8) CONST;
KeyDesc POINTER VALUE;
KeyDescFormat CHAR(8) CONST;
CryptoProvider CHAR(1) CONST;
CrpytoDevice CHAR(10) CONST;
APIError POINTER VALUE;
END-PR;

Call:
VerifySignature(%ADDR(Token):TokenLen:
%ADDR(Input):InputLen:'DATA0100':
%ADDR(ALGD0400):'ALGD0400':
%ADDR(KEYD0600):'KEYD0600':
'1':' ':%ADDR(apierror));


For testing, the JWT and public certificate are stored in regular RPGLE
CHAR variables. I'm able to decode the JWT to get the header and payload
in order to create the string for the input data parm (header + '.' +
payload). I put the JWT and the input data into *UTF8 variables before
passing them to the API.

PEMCertificate (in KEYD0600) is set to the text of the PEM formatted
certificate which for this test is set in an RPG string and then translated
to ASCII using QDCXLATE.

certificate = '-----BEGIN CERTIFICATE-----' + x'25' + etc.


Brian


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.