JDK-8058544 : SunMSCAPI provider KeyStore.aliases() returns non unique aliases
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-06-17
  • Updated: 2014-09-16
  • Resolved: 2014-09-16
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :


ADDITIONAL OS VERSION INFORMATION :
All Windows versions

A DESCRIPTION OF THE PROBLEM :
SunMSCAPI provider KeyStore.aliases() returns not unique aliases if we have two different certificates but this certificates have the same CN but different serial numbers

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Import to Windows-MY store two different certificates with the same CN but different serial number.
Get aliases enumeration from store.
Aliases are not unique.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This code should return CN, issuer and serial number to uniquely identify certificates.
ACTUAL -
This code returns two times the same CN value  which is not unique in this situation.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
KeyStore capi = KeyStore.getInstance("Windows-MY");
 capi.load(null, null);
        
 Enumeration<String> aliases = capi.aliases();
 while (aliases.hasMoreElements()) {
       String alias = (String) aliases.nextElement();
        System.out.println(alias);
}
---------- END SOURCE ----------