因此,也许您想查看 SYS1.SAMPLIB(CSFTEST) 中的示例如何从 REXX 中调用加密函数。对于散列生成,函数是 CSNBOWH(单向散列生成)。
如果您的大型机有加密,那么这个示例应该可以工作:
/* Rexx */ 00010000
00020000
/* initialize parameter list */ 00030000
RetCode = 'FFFFFFFF'x ; 00040000
Reason = 'FFFFFFFF'x ; 00050000
ExitLength = '00000000'x; 00060000
ExitData = '' ; 00070000
RuleArrayCount = '00000001'x ; 00080000
RuleArray = 'SHA-256 ' ; 00090000
TextLength = '00000040'x ; 00100001
Text = 'Applicationtext'!!copies('00'x,49); 00110001
/* 123456789+123456 */ 00120000
ChainVectorLen = '00000080'x; 00130001
ChainVector = copies('00'x,128); 00140001
HashLength = '00000020'x ; /* 32 bytes */ 00150000
Hash = copies('00'x,32); 00160000
00170000
/**********************************/ 00180000
/* Call One-Way Hash Generate */ 00190000
/**********************************/ 00200000
say 'Executing one-way hash generation ...' 00210000
say 00220000
address linkpgm 'CSNBOWH' , 00230000
'RetCode' , 00240000
'Reason' , 00250000
'ExitLength' , 00260000
'ExitData' , 00270000
'RuleArrayCount' , 00280000
'RuleArray' , 00290000
'TextLength' , 00300000
'Text' , 00310000
'ChainVectorLen' , 00320000
'ChainVector' , 00330000
'HashLength' , 00340000
'Hash'; 00350000
00360000
select; 00370000
00380000
/* return code 12 */ 00390000
when RetCode = '0000000C'x then 00400000
do; 00410000
if Reason = '00000000'x then 00420000
do; 00430000
say 'ICSF is not started or the DES/symmetric-key master key ' 00440000
say 'is not set'; 00450000
say 00460000
exit; 00470000
end; 00480000
if Reason = '00000008'x then 00490000
do; 00500000
say 'ICSF is started, the required cryptographic hardware is ' 00510000
say 'not available' 00520000
say 00530000
exit; 00540000
end; 00550000
end; 00560000
00570000
/* return code 0 */ 00580000
when RetCode = '00000000'x then 00590000
do 00600000
say 'successful completion ...'; 00610000
say 'Generated SHA 256 hash:' ; 00620001
say c2x(Hash); 00630001
say ; 00640000
end; 00650000
00660000
/* other return codes */ 00670000
otherwise 00680000
do 00690000
say 'CSNBOWH failed: rc =' c2x(RetCode) 'rs =' c2x(Reason) ; 00700000
say 00710000
exit; 00720000
end; 00730000
00740000
end; /* select */ 00750000
00760000
exit 00770000
可在https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.csfb400/owh.htm找到描述