Now I am working on an Android program that is related to IMS. I want the server to send nonce back to the client as a string and print it on the client side. To generate nonce , I tried using the code from this site.
http://www.exampledepot.com/egs/java.security/CreateSecureRandom.html
Some of my codes are as follows
public static String generateNonce() {
try {
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
byte[] bytes = new byte[1024/8];
sr.nextBytes(bytes);
int seedByteCount = 10;
byte[] seed = sr.generateSeed(seedByteCount);
sr = SecureRandom.getInstance("SHA1PRNG");
sr.setSeed(seed);
SecureRandom sr2 = SecureRandom.getInstance("SHA1PRNG");
sr2.setSeed(seed);
} catch (NoSuchAlgorithmException e) {
}
return null;
}
I announced NONCE = generateNonce();at the beginning. But the problem is not to get the nonce value, it prints as null on the client side. When I tried to print it on the server side, it also looks like null .
- , . .
,
Sebby.