on 08-11-2015 3:20 PM
Hi all,
I have defined a custom PI module for encrypt and decrypt fields in a xml,
For encrypt and decrypt the fields I'm using a varible=key array byte[], I need this varible is diferent in the several executions, for this reason I have the next code suurce where I asiggn a value to the variable Key with a random:
private byte[] secretKey=new byte[8];
Random random= new Random();
random.setSeed(System.currentTimeMillis());
random.nextBytes(secretKey);
but the problem is that always have the same coding in the several executions,I dont understand where is the problem.
Thanks and best regards.
Mónica
Hi Monica,
With System.currentTimeMillis() you would have different seed every time. I don't know if there is any problem to access to system variables, have you tried with the java.lang.Math method? coobird.net - How to Generate Random Numbers
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Iñaki,
Yes, I generate the randon the diferente forms, for example?
//KeyGenerator generator;
//generator = KeyGenerator.getInstance("DES");
//generator.init(new SecureRandom());
//this.secretKey= generator.generateKey().getEncoded();
and ocurr the same problem...
I think is a problem with the memory, the memory not being released in the several executions.., and dont understand the reason, could is a problem in PI?
Thanks,
Monica
Hi Monica,
At mapping level i think it is released. May be in adapter level, the adapter is running all the time and the memory is not released, although it seems to be weird. Have you tried to generate the random number from the mapping level and to take it in your new adapter as parameter?
Regards.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.