mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8181048: Refactor existing providers to refer to the same constants for default values for key length
Reviewed-by: mullan, ahgross
This commit is contained in:
parent
7cf3c0ff14
commit
b3f1165f7d
16 changed files with 378 additions and 136 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, 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
|
||||
|
@ -33,6 +33,7 @@ import javax.crypto.spec.DHParameterSpec;
|
|||
import javax.crypto.spec.DHGenParameterSpec;
|
||||
|
||||
import sun.security.provider.ParameterCache;
|
||||
import static sun.security.util.SecurityProviderConstants.DEF_DH_KEY_SIZE;
|
||||
|
||||
/**
|
||||
* This class represents the key pair generator for Diffie-Hellman key pairs.
|
||||
|
@ -42,8 +43,7 @@ import sun.security.provider.ParameterCache;
|
|||
* <ul>
|
||||
* <li>By providing the size in bits of the prime modulus -
|
||||
* This will be used to create a prime modulus and base generator, which will
|
||||
* then be used to create the Diffie-Hellman key pair. The default size of the
|
||||
* prime modulus is 2048 bits.
|
||||
* then be used to create the Diffie-Hellman key pair.
|
||||
* <li>By providing a prime modulus and base generator
|
||||
* </ul>
|
||||
*
|
||||
|
@ -68,7 +68,7 @@ public final class DHKeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
|
||||
public DHKeyPairGenerator() {
|
||||
super();
|
||||
initialize(2048, null);
|
||||
initialize(DEF_DH_KEY_SIZE, null);
|
||||
}
|
||||
|
||||
private static void checkKeySize(int keysize)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, 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
|
||||
|
@ -31,6 +31,8 @@ import java.security.spec.*;
|
|||
import javax.crypto.spec.DHParameterSpec;
|
||||
import javax.crypto.spec.DHGenParameterSpec;
|
||||
|
||||
import static sun.security.util.SecurityProviderConstants.DEF_DH_KEY_SIZE;
|
||||
|
||||
/*
|
||||
* This class generates parameters for the Diffie-Hellman algorithm.
|
||||
* The parameters are a prime, a base, and optionally the length in bits of
|
||||
|
@ -38,7 +40,6 @@ import javax.crypto.spec.DHGenParameterSpec;
|
|||
*
|
||||
* <p>The Diffie-Hellman parameter generation accepts the size in bits of the
|
||||
* prime modulus and the size in bits of the random exponent as input.
|
||||
* The size of the prime modulus defaults to 2048 bits.
|
||||
*
|
||||
* @author Jan Luehe
|
||||
*
|
||||
|
@ -50,7 +51,7 @@ import javax.crypto.spec.DHGenParameterSpec;
|
|||
public final class DHParameterGenerator extends AlgorithmParameterGeneratorSpi {
|
||||
|
||||
// The size in bits of the prime modulus
|
||||
private int primeSize = 2048;
|
||||
private int primeSize = DEF_DH_KEY_SIZE;
|
||||
|
||||
// The size in bits of the random exponent (private value)
|
||||
private int exponentSize = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue