This source file includes following definitions.
- getBytes
package org.chromium.content.browser.crypto;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.GeneralSecurityException;
public class ByteArrayGenerator {
public byte[] getBytes(int numBytes) throws IOException, GeneralSecurityException {
FileInputStream fis = null;
try {
fis = new FileInputStream("/dev/urandom");
byte[] bytes = new byte[numBytes];
if (bytes.length != fis.read(bytes)) {
throw new GeneralSecurityException("Not enough random data available");
}
return bytes;
} finally {
if (fis != null) {
fis.close();
}
}
}
}