8208675: Remove legacy sun.security.key.serial.interop property
Reviewed-by: mullan
--- a/src/java.base/share/classes/sun/security/provider/DSAKeyFactory.java Fri Aug 17 13:37:01 2018 -0700
+++ b/src/java.base/share/classes/sun/security/provider/DSAKeyFactory.java Fri Aug 17 22:20:47 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -30,7 +30,6 @@
import java.security.PrivateKey;
import java.security.KeyFactorySpi;
import java.security.InvalidKeyException;
-import java.security.AccessController;
import java.security.interfaces.DSAParams;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.DSAPrivateKeySpec;
@@ -39,8 +38,6 @@
import java.security.spec.X509EncodedKeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
-import sun.security.action.GetPropertyAction;
-
/**
* This class implements the DSA key factory of the Sun provider.
*
@@ -51,29 +48,6 @@
*/
public class DSAKeyFactory extends KeyFactorySpi {
-
- // package private for DSAKeyPairGenerator
- static final boolean SERIAL_INTEROP;
- private static final String SERIAL_PROP = "sun.security.key.serial.interop";
-
- static {
-
- /**
- * Check to see if we need to maintain interoperability for serialized
- * keys between JDK 5.0 -> JDK 1.4. In other words, determine whether
- * a key object serialized in JDK 5.0 must be deserializable in
- * JDK 1.4.
- *
- * If true, then we generate sun.security.provider.DSAPublicKey.
- * If false, then we generate sun.security.provider.DSAPublicKeyImpl.
- *
- * By default this is false.
- * This incompatibility was introduced by 4532506.
- */
- String prop = GetPropertyAction.privilegedGetProperty(SERIAL_PROP);
- SERIAL_INTEROP = "true".equalsIgnoreCase(prop);
- }
-
/**
* Generates a public key object from the provided key specification
* (key material).
@@ -90,25 +64,13 @@
try {
if (keySpec instanceof DSAPublicKeySpec) {
DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec;
- if (SERIAL_INTEROP) {
- return new DSAPublicKey(dsaPubKeySpec.getY(),
- dsaPubKeySpec.getP(),
- dsaPubKeySpec.getQ(),
- dsaPubKeySpec.getG());
- } else {
- return new DSAPublicKeyImpl(dsaPubKeySpec.getY(),
- dsaPubKeySpec.getP(),
- dsaPubKeySpec.getQ(),
- dsaPubKeySpec.getG());
- }
+ return new DSAPublicKeyImpl(dsaPubKeySpec.getY(),
+ dsaPubKeySpec.getP(),
+ dsaPubKeySpec.getQ(),
+ dsaPubKeySpec.getG());
} else if (keySpec instanceof X509EncodedKeySpec) {
- if (SERIAL_INTEROP) {
- return new DSAPublicKey
- (((X509EncodedKeySpec)keySpec).getEncoded());
- } else {
- return new DSAPublicKeyImpl
- (((X509EncodedKeySpec)keySpec).getEncoded());
- }
+ return new DSAPublicKeyImpl
+ (((X509EncodedKeySpec)keySpec).getEncoded());
} else {
throw new InvalidKeySpecException
("Inappropriate key specification");
--- a/src/java.base/share/classes/sun/security/provider/DSAKeyPairGenerator.java Fri Aug 17 13:37:01 2018 -0700
+++ b/src/java.base/share/classes/sun/security/provider/DSAKeyPairGenerator.java Fri Aug 17 22:20:47 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -166,11 +166,7 @@
// See the comments in DSAKeyFactory, 4532506, and 6232513.
DSAPublicKey pub;
- if (DSAKeyFactory.SERIAL_INTEROP) {
- pub = new DSAPublicKey(y, p, q, g);
- } else {
- pub = new DSAPublicKeyImpl(y, p, q, g);
- }
+ pub = new DSAPublicKeyImpl(y, p, q, g);
DSAPrivateKey priv = new DSAPrivateKey(x, p, q, g);
KeyPair pair = new KeyPair(pub, priv);