AlgorithmParameterGenerator.java, [...]: Import statements reorganized...
2004-10-20 Michael Koch <konqueror@gmx.de> * java/security/AlgorithmParameterGenerator.java, java/security/AlgorithmParameters.java, java/security/DigestInputStream.java, java/security/Identity.java, java/security/KeyFactory.java, java/security/KeyPairGenerator.java, java/security/KeyStore.java, java/security/MessageDigest.java, java/security/MessageDigestSpi.java, java/security/Policy.java, java/security/SecureRandom.java, java/security/Security.java, java/security/Signature.java, java/security/SignatureSpi.java, java/security/cert/CertPathBuilder.java, java/security/cert/CertPathValidator.java, java/security/cert/CertStore.java, java/security/cert/Certificate.java, java/security/cert/CertificateFactory.java, java/security/cert/PolicyQualifierInfo.java, java/security/cert/TrustAnchor.java, java/security/cert/X509CRL.java, java/security/cert/X509CRLEntry.java, java/security/cert/X509Certificate.java, java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java: Import statements reorganized, some little formatting issues, used java-style array declarations, added comments in empty catch blocks. From-SVN: r89319
This commit is contained in:
parent
f45bdcd05e
commit
242b11bd65
26 changed files with 98 additions and 49 deletions
|
@ -87,7 +87,7 @@ public class SecureRandom extends Random
|
|||
*/
|
||||
public SecureRandom()
|
||||
{
|
||||
Provider p[] = Security.getProviders();
|
||||
Provider[] p = Security.getProviders();
|
||||
|
||||
//Format of Key: SecureRandom.algname
|
||||
String key;
|
||||
|
@ -112,7 +112,10 @@ public class SecureRandom extends Random
|
|||
provider = p[i];
|
||||
return;
|
||||
}
|
||||
catch (Throwable ignore) { }
|
||||
catch (Throwable t)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,18 +170,20 @@ public class SecureRandom extends Random
|
|||
* @throws NoSuchAlgorithmException If no installed provider implements
|
||||
* the given algorithm.
|
||||
*/
|
||||
public static SecureRandom getInstance(String algorithm) throws
|
||||
NoSuchAlgorithmException
|
||||
public static SecureRandom getInstance(String algorithm)
|
||||
throws NoSuchAlgorithmException
|
||||
{
|
||||
Provider p[] = Security.getProviders();
|
||||
Provider[] p = Security.getProviders();
|
||||
|
||||
for (int i = 0; i < p.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
return getInstance(algorithm, p[i]);
|
||||
}
|
||||
catch (NoSuchAlgorithmException ignored)
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +289,7 @@ public class SecureRandom extends Random
|
|||
// Therefore we test.
|
||||
if (secureRandomSpi != null)
|
||||
{
|
||||
byte tmp[] = { (byte) (0xff & (seed >> 56)),
|
||||
byte[] tmp = { (byte) (0xff & (seed >> 56)),
|
||||
(byte) (0xff & (seed >> 48)),
|
||||
(byte) (0xff & (seed >> 40)),
|
||||
(byte) (0xff & (seed >> 32)),
|
||||
|
@ -324,7 +329,7 @@ public class SecureRandom extends Random
|
|||
if (numBits == 0)
|
||||
return 0;
|
||||
|
||||
byte tmp[] = new byte[numBits / 8 + (1 * (numBits % 8))];
|
||||
byte[] tmp = new byte[numBits / 8 + (1 * (numBits % 8))];
|
||||
|
||||
secureRandomSpi.engineNextBytes(tmp);
|
||||
randomBytesUsed += tmp.length;
|
||||
|
@ -349,7 +354,7 @@ public class SecureRandom extends Random
|
|||
*/
|
||||
public static byte[] getSeed(int numBytes)
|
||||
{
|
||||
byte tmp[] = new byte[numBytes];
|
||||
byte[] tmp = new byte[numBytes];
|
||||
|
||||
new Random().nextBytes(tmp);
|
||||
return tmp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue