RXS_HMAC()
Performs HMAC calculation.
Requires both a secret as well as a configured RXS_HMACDS_t data structure to be passed in as parameters.
Subprocedure Prototype
|
Returns a calculated HMAC string. Note that if OutputStmf is set to an IFS path in the configuration data structure, the HMAC string will be written there instead. |
|
Holds the data to be encrypted as part of HMAC calculation. Note that if InputStmf is set to an IFS path in the configuration data structure, the input will be read from there instead. |
|
The secret used for HMAC calculation. |
|
Controls how HMAC calculation is performed. Uses RXS_HMACDS_t as a template. |
Example Code
*--------------------------------------------------------------
* This example demonstrates how to perform a simple SHA-1 HMAC
* calculation with RXS_HMAC. This example returns the HMAC string
* as text.
* This example is based on a test case from RFC 2202:
* https://www.rfc-editor.org/rfc/rfc2202
*--------------------------------------------------------------
Ctl-Opt ActGrp(*New) BndDir('RXSBND');
/COPY QRPGLECPY,RXSCB
Dcl-Ds HMACDS LikeDS(RXS_HMACDS_t);
Dcl-S Input Like(RXS_Var1Kv_t) Inz;
Dcl-S Secret Like(RXS_Var1Kv_t) Inz;
Dcl-S Output Like(RXS_Var1Kv_t) Inz;
RXS_ResetDS( HMACDS : RXS_DS_TYPE_HMAC );
Input = 'what do ya want for nothing?';
Secret = 'Jefe';
HMACDS.InputCcsid = RXS_CCSID_EBCDIC;
HMACDS.SecretCcsid = RXS_CCSID_EBCDIC;
HMACDS.EncryptAsCcsid = RXS_CCSID_ISO88591;
HMACDS.Algorithm = RXS_HMAC_SHA1;
Output = RXS_HMAC( Input : Secret : HMACDS );
Data Structures
|
|
|
If an error occurs during processing, additional error information may be returned in this data structure. |
|
Internal use only |
|
|
|
Determines which algorithm to use when encrypting. Valid Values:
|
|
CCSID of input data. Used when the input data is of a different CCSID than the job CCSID. Not necessary if using InputStmf. Default Value: |
|
CCSID of secret used for HMAC calculation. Used when the secret is of a different CCSID than the job CCSID. Default Value: |
|
When performing HMAC calculation, this field will specify the CCSID in which the data should be encrypted. If this value is different than the InputCcsid value, the data will be converted before encryption. Default Value: |
|
Specifies whether to return the character representation of the hexadecimal binary data. Valid Values:
Default Value: |
|
Optional IFS stream file to use as input data for HMAC calculation. |
|
Optional IFS stream file where HMAC output will be written. |
|
Internal use only |
|
Internal use only |
|
Internal use only |
|
Internal use only |