-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8308453: Convert JKS test keystores in test/jdk/javax/net/ssl/etc to PKCS12 #16159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back kdriver! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
The ones you changed to PKCS12 is fine, but you should also convert the binary keystores in the
|
I have done so now. Please re-review. |
There are other tests under |
…harness; set it explicitly
I have 2 comments:
|
test/jdk/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java
Outdated
Show resolved
Hide resolved
ks.load(new FileInputStream(keyStoreFile), passphrase); | ||
ts.load(new FileInputStream(keyStoreFile), passphrase); | ||
KeyStore ks = KeyStore.getInstance(new File(keyStoreFile), passphrase); | ||
KeyStore ts = KeyStore.getInstance(new File(keyStoreFile), passphrase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deliberate
ks.load(new FileInputStream(keyStoreFile), passphrase); | ||
ts.load(new FileInputStream(keyStoreFile), passphrase); | ||
KeyStore ks = KeyStore.getInstance(new File(keyStoreFile), passphrase); | ||
KeyStore ts = KeyStore.getInstance(new File(keyStoreFile), passphrase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deliberate
@@ -41,6 +41,8 @@ public static void main(String[] argv) throws Exception { | |||
String testRoot = System.getProperty("test.src", "."); | |||
System.setProperty("javax.net.ssl.trustStore", testRoot | |||
+ "/../../../../javax/net/ssl/etc/truststore"); | |||
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deliberate
@@ -41,6 +41,8 @@ public static void main(String[] argv) throws Exception { | |||
String testRoot = System.getProperty("test.src", "."); | |||
System.setProperty("javax.net.ssl.trustStore", testRoot | |||
+ "/../../../../javax/net/ssl/etc/truststore"); | |||
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12"); | |||
System.setProperty("javax.net.ssl.trustStorePassword", "passphrase"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deliberate
@@ -438,10 +438,9 @@ private static void checkResumedClientHelloSNI(ByteBuffer resCliHello) | |||
private static TrustManagerFactory makeTrustManagerFactory(String tsPath, | |||
char[] pass) throws GeneralSecurityException, IOException { | |||
TrustManagerFactory tmf; | |||
KeyStore ts = KeyStore.getInstance("JKS"); | |||
|
|||
try (FileInputStream fsIn = new FileInputStream(tsPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this FileInputStream
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this due to the "try." I can remove if you prefer, but it seemed like it was better to leave in this check for the existence of the file due to the declared exception in the method signature.
@@ -463,10 +462,9 @@ private static TrustManagerFactory makeTrustManagerFactory(String tsPath, | |||
private static KeyManagerFactory makeKeyManagerFactory(String ksPath, | |||
char[] pass) throws GeneralSecurityException, IOException { | |||
KeyManagerFactory kmf; | |||
KeyStore ks = KeyStore.getInstance("JKS"); | |||
|
|||
try (FileInputStream fsIn = new FileInputStream(ksPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this FileInputStream
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this due to the "try." I can remove if you prefer, but it seemed like it was better to leave in this check for the existence of the file due to the declared exception in the method signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean, but in any of these tests, no matter if a FNFE or an IAE is thrown, it's not handled and the test simply fails. I don't think it's worth checking twice on the existence of the file.
@@ -315,9 +315,10 @@ public static void main(String[] args) throws Exception { | |||
|
|||
sslctx = SSLContext.getInstance("TLS"); | |||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); | |||
KeyStore ks = KeyStore.getInstance("JKS"); | |||
KeyStore ks; | |||
try (FileInputStream fis = new FileInputStream(keyFilename)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this FileInputStream
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this due to the "try." I can remove if you prefer, but it seemed like it was better to leave in this check for the existence of the file due to the declared exception in the method signature.
KeyStore ks = KeyStore.getInstance("JKS"); | ||
KeyStore ts = KeyStore.getInstance("JKS"); | ||
KeyStore ks; | ||
KeyStore ts; | ||
|
||
char[] passphrase = "passphrase".toCharArray(); | ||
|
||
try (FileInputStream keyFile = new FileInputStream(keyFilename); | ||
FileInputStream trustFile = new FileInputStream(trustFilename)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for these FileInputStream
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this due to the "try." I can remove if you prefer, but it seemed like it was better to leave in this check for the existence of the file due to the declared exception in the method signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
BTW, have you considered making truststore
a password-less pkcs12 file? Then there is no need to provide a password for it. You can create one with -J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -J-Dkeystore.pkcs12.macAlgorithm=NONE
when calling the keytool -importkeystore
command.
@driverkt This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 1696603.
Your commit was automatically rebased without conflicts. |
JDK-8308453: JSSE regression test keystore migration from JKS to PKCS12
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16159/head:pull/16159
$ git checkout pull/16159
Update a local copy of the PR:
$ git checkout pull/16159
$ git pull https://git.openjdk.org/jdk.git pull/16159/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16159
View PR using the GUI difftool:
$ git pr show -t 16159
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16159.diff
Webrev
Link to Webrev Comment