muadeep
23-03-06, 07:48
Hab da mal wieder ein Problem
wir wollen/müssen Daten nach dem RC4 (Ron's Cipher 4) auf der AS400 verschlüssen/entschlüsseln!
hab auch schon mal Mr. "google" gefragt und dann folgendes Programm gefunden!
H DFTACTGRP(*NO) BNDDIR('QC2LE') option(*SRCSTMT: *NODEBUGIO)
D pstring s 20A
D encrypt s 1A
D key s 16A varying inz('CrypTEDkEy')
D InpString s 21
D OutString s Like(InpString)
D RC4_Controls ds
D funct_id 2A
D datalen 5U 0
D operation 1A
D reserved 11A
D p_key_ctx *
D key_ctx ds
D stream 256A
D len 5U 0
D reserved2 6A
D cipher PR extproc('_CIPHER')
D receiver *
D control 32A
D source *
D p_recv s *
D p_src s *
C *Entry PList
C Parm pstring
C Parm encrypt
* The following will store a null-terminating byte
* at the end of InpString as required by the C API _CIPHER.
C Eval %str(%addr(InpString) :
C %len(%trim(pstring)) + 1) = pstring
* The following will encrypt or decrypt "InpString" using the RC4
* algorithm with the secret key "key", and place the result
* into "OutString"
C Eval key_ctx = *ALLx'00'
C Eval stream = *ALLx'00'
C Eval reserved2= *ALLx'00'
C Eval %subst(stream:1:%len(key)) = key
C Eval len = %len(key)
C Eval RC4_Controls = *ALLx'00'
C Eval funct_id = x'0013'
C Eval datalen = %size(InpString)
C Select
C When encrypt = 'E'
C Eval operation = x'00'
C When encrypt = 'D'
C Eval operation = x'01'
C EndSl
C Eval reserved = *ALLx'00'
C Eval p_key_ctx = %addr(key_ctx)
C Eval p_recv = %addr(OutString)
C Eval p_src = %addr(InpString)
C CallP cipher( p_recv: RC4_Controls: p_src)
C Seton LR
Dieses Pgm. soll ab V5.2 laufen (wir haben V5.3)
Umwandeln funkt auch prima, nur wenn ich das Programm aufrufe/debuge, dann bekomme ich bei:
C CallP cipher( p_recv: RC4_Controls: p_src)
folgende Fehlermeldung:
Die angeforderte Funktion ist ungültig oder nicht verfügbar auf der Maschine
cipher bzw. _cipher soll angeblich ein API sein !!!!
Hat jemand Erfahrung damit o. kann mir jemand weiterhelfen was ich falsch mache, bzw. wo ich dieses API herbekomme!
wir wollen/müssen Daten nach dem RC4 (Ron's Cipher 4) auf der AS400 verschlüssen/entschlüsseln!
hab auch schon mal Mr. "google" gefragt und dann folgendes Programm gefunden!
H DFTACTGRP(*NO) BNDDIR('QC2LE') option(*SRCSTMT: *NODEBUGIO)
D pstring s 20A
D encrypt s 1A
D key s 16A varying inz('CrypTEDkEy')
D InpString s 21
D OutString s Like(InpString)
D RC4_Controls ds
D funct_id 2A
D datalen 5U 0
D operation 1A
D reserved 11A
D p_key_ctx *
D key_ctx ds
D stream 256A
D len 5U 0
D reserved2 6A
D cipher PR extproc('_CIPHER')
D receiver *
D control 32A
D source *
D p_recv s *
D p_src s *
C *Entry PList
C Parm pstring
C Parm encrypt
* The following will store a null-terminating byte
* at the end of InpString as required by the C API _CIPHER.
C Eval %str(%addr(InpString) :
C %len(%trim(pstring)) + 1) = pstring
* The following will encrypt or decrypt "InpString" using the RC4
* algorithm with the secret key "key", and place the result
* into "OutString"
C Eval key_ctx = *ALLx'00'
C Eval stream = *ALLx'00'
C Eval reserved2= *ALLx'00'
C Eval %subst(stream:1:%len(key)) = key
C Eval len = %len(key)
C Eval RC4_Controls = *ALLx'00'
C Eval funct_id = x'0013'
C Eval datalen = %size(InpString)
C Select
C When encrypt = 'E'
C Eval operation = x'00'
C When encrypt = 'D'
C Eval operation = x'01'
C EndSl
C Eval reserved = *ALLx'00'
C Eval p_key_ctx = %addr(key_ctx)
C Eval p_recv = %addr(OutString)
C Eval p_src = %addr(InpString)
C CallP cipher( p_recv: RC4_Controls: p_src)
C Seton LR
Dieses Pgm. soll ab V5.2 laufen (wir haben V5.3)
Umwandeln funkt auch prima, nur wenn ich das Programm aufrufe/debuge, dann bekomme ich bei:
C CallP cipher( p_recv: RC4_Controls: p_src)
folgende Fehlermeldung:
Die angeforderte Funktion ist ungültig oder nicht verfügbar auf der Maschine
cipher bzw. _cipher soll angeblich ein API sein !!!!
Hat jemand Erfahrung damit o. kann mir jemand weiterhelfen was ich falsch mache, bzw. wo ich dieses API herbekomme!