Skip to content

fix: Safkeyring truststore bug fix in certificate-analyzer#4595

Open
hrishikesh-nalawade wants to merge 6 commits intov3.x.xfrom
hrishikesh-nalawade/GH4592/certificate-analyzer-bug
Open

fix: Safkeyring truststore bug fix in certificate-analyzer#4595
hrishikesh-nalawade wants to merge 6 commits intov3.x.xfrom
hrishikesh-nalawade/GH4592/certificate-analyzer-bug

Conversation

@hrishikesh-nalawade
Copy link
Copy Markdown
Member

Description

When the certificate-analyser is invoked with a SAF keyring truststore path (e.g. safkeyring://ZWESMVD/ZoweKeyring, type JCERACFKS), the initTruststore() method in Stores.java always uses FileInputStream to open the truststore.

The initKeystore() method in the same class correctly checks isKeyring() and uses keyRingUrl()openStream() for SAF keyrings, but this handling was never added to initTrustore()

Linked to #4592

Type of change

  • fix: Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • PR title conforms to commit message guideline ## Commit Message Structure Guideline
  • I have commented my code, particularly in hard-to-understand areas. In JS I did provide JSDoc
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The java tests in the area I was working on leverage @nested annotations
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: hrishikesh-nalawade <hrishikesh.nalawade.17@gmail.com>
hrishikesh-nalawade and others added 2 commits April 25, 2026 01:09
Signed-off-by: hrishikesh-nalawade <hrishikesh.nalawade.17@gmail.com>
* On non-z/OS platforms the handler class is simply not found and is ignored.
*/
static void ensureSafkeyringHandler() {
String existing = System.getProperty("java.protocol.handler.pkgs", "");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the start.sh scripts for API ML components we have java.protocol.handler.pkgs always set to com.ibm.crypto.provider. Should we have it the same way also for the analyser?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have the place to push this in, I would say yes.

@balhar-jakub balhar-jakub moved this from New to In Progress in API Mediation Layer Backlog Management Apr 29, 2026
@balhar-jakub
Copy link
Copy Markdown
Member

Is the Draft label still intentional?

Also do you see adding any unit tests to validate that it won't repeat?

@balhar-jakub balhar-jakub changed the title Fix: Safkeyring truststore bug fix in certificate-analyzer fix: Safkeyring truststore bug fix in certificate-analyzer May 4, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
73.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

String existing = System.getProperty("java.protocol.handler.pkgs", "");
if (!existing.contains("com.ibm.crypto.provider")) {
System.setProperty("java.protocol.handler.pkgs",
existing.isEmpty() ? "com.ibm.crypto.provider" : existing + "|com.ibm.crypto.provider");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if this works with Java 21 too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants