8246383: NullPointerException in JceSecurity.getVerificationResult when using Entrust provider
Removed the static SecureRandom object in JceSecurity whose instantion caused NPE Reviewed-by: xuelei
This commit is contained in:
parent
b2da6e1a90
commit
03f2ab325d
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,6 +27,7 @@ package java.security;
|
|||||||
|
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import sun.security.jca.JCAUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code AlgorithmParameterGenerator} class is used to generate a
|
* The {@code AlgorithmParameterGenerator} class is used to generate a
|
||||||
@ -308,7 +309,7 @@ public class AlgorithmParameterGenerator {
|
|||||||
* @param size the size (number of bits).
|
* @param size the size (number of bits).
|
||||||
*/
|
*/
|
||||||
public final void init(int size) {
|
public final void init(int size) {
|
||||||
paramGenSpi.engineInit(size, new SecureRandom());
|
paramGenSpi.engineInit(size, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -339,7 +340,7 @@ public class AlgorithmParameterGenerator {
|
|||||||
*/
|
*/
|
||||||
public final void init(AlgorithmParameterSpec genParamSpec)
|
public final void init(AlgorithmParameterSpec genParamSpec)
|
||||||
throws InvalidAlgorithmParameterException {
|
throws InvalidAlgorithmParameterException {
|
||||||
paramGenSpi.engineInit(genParamSpec, new SecureRandom());
|
paramGenSpi.engineInit(genParamSpec, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1233,7 +1233,7 @@ public class Cipher {
|
|||||||
* by the underlying {@code CipherSpi}.
|
* by the underlying {@code CipherSpi}.
|
||||||
*/
|
*/
|
||||||
public final void init(int opmode, Key key) throws InvalidKeyException {
|
public final void init(int opmode, Key key) throws InvalidKeyException {
|
||||||
init(opmode, key, JceSecurity.RANDOM);
|
init(opmode, key, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1372,7 +1372,7 @@ public class Cipher {
|
|||||||
public final void init(int opmode, Key key, AlgorithmParameterSpec params)
|
public final void init(int opmode, Key key, AlgorithmParameterSpec params)
|
||||||
throws InvalidKeyException, InvalidAlgorithmParameterException
|
throws InvalidKeyException, InvalidAlgorithmParameterException
|
||||||
{
|
{
|
||||||
init(opmode, key, params, JceSecurity.RANDOM);
|
init(opmode, key, params, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1513,7 +1513,7 @@ public class Cipher {
|
|||||||
public final void init(int opmode, Key key, AlgorithmParameters params)
|
public final void init(int opmode, Key key, AlgorithmParameters params)
|
||||||
throws InvalidKeyException, InvalidAlgorithmParameterException
|
throws InvalidKeyException, InvalidAlgorithmParameterException
|
||||||
{
|
{
|
||||||
init(opmode, key, params, JceSecurity.RANDOM);
|
init(opmode, key, params, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1659,7 +1659,7 @@ public class Cipher {
|
|||||||
public final void init(int opmode, Certificate certificate)
|
public final void init(int opmode, Certificate certificate)
|
||||||
throws InvalidKeyException
|
throws InvalidKeyException
|
||||||
{
|
{
|
||||||
init(opmode, certificate, JceSecurity.RANDOM);
|
init(opmode, certificate, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -75,11 +75,8 @@ import sun.security.util.Debug;
|
|||||||
|
|
||||||
final class JceSecurity {
|
final class JceSecurity {
|
||||||
|
|
||||||
|
|
||||||
private static final Debug debug = Debug.getInstance("jca");
|
private static final Debug debug = Debug.getInstance("jca");
|
||||||
|
|
||||||
static final SecureRandom RANDOM = new SecureRandom();
|
|
||||||
|
|
||||||
// The defaultPolicy and exemptPolicy will be set up
|
// The defaultPolicy and exemptPolicy will be set up
|
||||||
// in the static initializer.
|
// in the static initializer.
|
||||||
private static CryptoPermissions defaultPolicy = null;
|
private static CryptoPermissions defaultPolicy = null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -446,7 +446,7 @@ public class KeyAgreement {
|
|||||||
* has an incompatible algorithm type.
|
* has an incompatible algorithm type.
|
||||||
*/
|
*/
|
||||||
public final void init(Key key) throws InvalidKeyException {
|
public final void init(Key key) throws InvalidKeyException {
|
||||||
init(key, JceSecurity.RANDOM);
|
init(key, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -514,7 +514,7 @@ public class KeyAgreement {
|
|||||||
public final void init(Key key, AlgorithmParameterSpec params)
|
public final void init(Key key, AlgorithmParameterSpec params)
|
||||||
throws InvalidKeyException, InvalidAlgorithmParameterException
|
throws InvalidKeyException, InvalidAlgorithmParameterException
|
||||||
{
|
{
|
||||||
init(key, params, JceSecurity.RANDOM);
|
init(key, params, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getProviderName() {
|
private String getProviderName() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -449,7 +449,7 @@ public class KeyGenerator {
|
|||||||
public final void init(AlgorithmParameterSpec params)
|
public final void init(AlgorithmParameterSpec params)
|
||||||
throws InvalidAlgorithmParameterException
|
throws InvalidAlgorithmParameterException
|
||||||
{
|
{
|
||||||
init(params, JceSecurity.RANDOM);
|
init(params, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -513,7 +513,7 @@ public class KeyGenerator {
|
|||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
public final void init(int keysize) {
|
public final void init(int keysize) {
|
||||||
init(keysize, JceSecurity.RANDOM);
|
init(keysize, JCAUtil.getSecureRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user