2017-07-31 110 views
0

我调查了加密字符串unsing rexx(大型机ZOS)的问题。 我发现一些有用的链接: http://rexxeec.sourceforge.net/doc/RexxEEC.pdf enter image description hereSHA256在大型机中。 REXX中是否存在函数?

但是,当我试图在TSO使用它,我得到了一个错误:

**16 +++ hash = eecsha(str)** 
 
    
 
My source: 
 
    
 
/* Rexx */            
 
str = '*#*@'           
 
hash = eecsha(str)         
 
Say 'SHA value (in hex) of string' str 'is:' hash 

所以,也许我忘了补充任何lib?或者这是完全不可能的,我必须自己写SHA256?

顺便说一句,我从DB2上取了一行进行加密,看起来像不可能使用如下所示的收缩: 从表中选择HASH(column,2); 使用ZOS DB2

回答

2

如果我回去的SourceForge页面本身,它指出:

Rexx/EEC is an external function package that provides functions for Encrypting

所以回答你的问题,是的,除非你补充说,库,你实际上丢失了。

0

所以,也许你想看看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

找到