mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8315974: Make fields final in 'com.sun.crypto.provider' package
Reviewed-by: valeriep
This commit is contained in:
parent
8dd809642e
commit
4e77b3c378
31 changed files with 91 additions and 106 deletions
|
@ -53,7 +53,7 @@ final class DHPrivateKey implements PrivateKey,
|
|||
private static final BigInteger PKCS8_VERSION = BigInteger.ZERO;
|
||||
|
||||
// the private key
|
||||
private BigInteger x;
|
||||
private final BigInteger x;
|
||||
|
||||
// the key bytes, without the algorithm information
|
||||
private byte[] key;
|
||||
|
@ -68,7 +68,7 @@ final class DHPrivateKey implements PrivateKey,
|
|||
private final BigInteger g;
|
||||
|
||||
// the private-value length (optional)
|
||||
private int l;
|
||||
private final int l;
|
||||
|
||||
/**
|
||||
* Make a DH private key out of a private value <code>x</code>, a prime
|
||||
|
@ -161,6 +161,8 @@ final class DHPrivateKey implements PrivateKey,
|
|||
// Private-value length is OPTIONAL
|
||||
if (params.data.available() != 0) {
|
||||
this.l = params.data.getInteger();
|
||||
} else {
|
||||
this.l = 0;
|
||||
}
|
||||
if (params.data.available() != 0) {
|
||||
throw new InvalidKeyException("Extra parameter data");
|
||||
|
@ -170,7 +172,9 @@ final class DHPrivateKey implements PrivateKey,
|
|||
// privateKey
|
||||
//
|
||||
this.key = val.data.getOctetString();
|
||||
parseKeyBits();
|
||||
|
||||
DerInputStream in = new DerInputStream(this.key);
|
||||
this.x = in.getBigInteger();
|
||||
|
||||
this.encodedKey = encodedKey.clone();
|
||||
} catch (IOException | NumberFormatException e) {
|
||||
|
@ -271,16 +275,6 @@ final class DHPrivateKey implements PrivateKey,
|
|||
}
|
||||
}
|
||||
|
||||
private void parseKeyBits() throws InvalidKeyException {
|
||||
try {
|
||||
DerInputStream in = new DerInputStream(this.key);
|
||||
this.x = in.getBigInteger();
|
||||
} catch (IOException e) {
|
||||
throw new InvalidKeyException(
|
||||
"Error parsing key encoding: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates a hash code value for the object.
|
||||
* Objects that are equal will also have the same hashcode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue