Here's a routine I have for using it:
(prototype for the CIPHER MI, doc at
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/tstudio/tech_ref/mi/CIPHER.htm)
Dcipher PR extproc('_CIPHER')
D receiver *
D control 96A OPTIONS(*VARSIZE)
D source *
(actual procedure)
*//////////////////////////////////////////////////////////////*
* (GenAESSalt) Generate a 16 byte salt for use with AES. *
*//////////////////////////////////////////////////////////////*
PGenAESSalt B
*--------------------------------------------------------------*
DGenAESSalt PI 16A
DPRN_Controls DS
D FunctionID 2A
D SeedRequest 1A
D Reserved1 3A
D SeedLength 5U 0
D PRNRequest 1A
D PRNParity 1A
D Reserved2 4A
D NumberOfPRNs 5U 0
D Reserverd3 16A
DNO_SEED C const(x'00')
DADD_SEED C const(x'01')
DGEN_REAL_PRN C const(x'00')
DGEN_TEST_PRN C const(x'01')
DNO_PARITY C const(x'00')
DODD_PARITY C const(x'01')
DEVEN_PARITY C const(x'02')
Dp_recv S *
DP_src S *
Dbuff_in S 16A
Dbuff_out S 16A
/free
p_recv = %addr(buff_out);
p_src = %addr(buff_in);
//
// Setup CIPHER for a secure random number
//
PRN_Controls = *ALLx'00';
FunctionID = FUNCID_PRN;
PRNRequest = GEN_REAL_PRN;
// NumberOfPRNs is the number of bytes to return.
NumberOfPRNs = 16;
PRNParity = NO_PARITY;
//
// Generate a secure random number
//
cipher(p_recv: PRN_Controls: p_src);
return buff_out;
/end-free
PGenAESSalt E
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Nathan Andelin
Sent: Monday, September 08, 2008 3:29 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Random String Generator
Haas, Matt (CL Tech Sv) wrote:
What random number generator are you using?
I wrote an RPG wrapper around the CEERAN0 api, and applied logic so the
result would fit within minimum-maximum range parameters.
I wasn't aware of the random number procedures in the crypto package, so
thanks for the tip.
Nathan.
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.