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:
Valerie Peng 2020-08-21 03:09:42 +00:00
parent b2da6e1a90
commit 03f2ab325d
5 changed files with 15 additions and 17 deletions

View file

@ -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.
*
* 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.util.Objects;
import sun.security.jca.JCAUtil;
/**
* The {@code AlgorithmParameterGenerator} class is used to generate a
@ -308,7 +309,7 @@ public class AlgorithmParameterGenerator {
* @param size the size (number of bits).
*/
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)
throws InvalidAlgorithmParameterException {
paramGenSpi.engineInit(genParamSpec, new SecureRandom());
paramGenSpi.engineInit(genParamSpec, JCAUtil.getSecureRandom());
}
/**