mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +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
|
@ -49,7 +49,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
private static final long serialVersionUID = 7647557958927458271L;
|
||||
|
||||
// the public key
|
||||
private BigInteger y;
|
||||
private final BigInteger y;
|
||||
|
||||
// the key bytes, without the algorithm information
|
||||
private byte[] key;
|
||||
|
@ -64,10 +64,10 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
private final BigInteger g;
|
||||
|
||||
// the private-value length (optional)
|
||||
private int l;
|
||||
private final int l;
|
||||
|
||||
// Note: this OID is used by DHPrivateKey as well.
|
||||
static ObjectIdentifier DH_OID =
|
||||
static final ObjectIdentifier DH_OID =
|
||||
ObjectIdentifier.of(KnownOIDs.DiffieHellman);
|
||||
|
||||
/**
|
||||
|
@ -153,6 +153,8 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
// 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");
|
||||
|
@ -162,7 +164,10 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
* Parse the key
|
||||
*/
|
||||
this.key = derKeyVal.data.getBitString();
|
||||
parseKeyBits();
|
||||
|
||||
DerInputStream in = new DerInputStream(this.key);
|
||||
this.y = in.getBigInteger();
|
||||
|
||||
if (derKeyVal.data.available() != 0) {
|
||||
throw new InvalidKeyException("Excess key data");
|
||||
}
|
||||
|
@ -263,16 +268,6 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
private void parseKeyBits() throws InvalidKeyException {
|
||||
try {
|
||||
DerInputStream in = new DerInputStream(this.key);
|
||||
this.y = in.getBigInteger();
|
||||
} catch (IOException e) {
|
||||
throw new InvalidKeyException(
|
||||
"Error parsing key encoding: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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