Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6782021

It is not possible to read local computer certificates with the SunMSCAPI provider

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b23
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A DESCRIPTION OF THE REQUEST :
      Only 2 keystore types are available with the SunMSCAPI provider (Windows-MY / Windows-ROOT)..
      None of this 2 types allows to retrieve the local computer certificates, only the user ertificates can be seen.


      JUSTIFICATION :
      There is no way to access the local computer certificates using java.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Either define a new store type like Windows-LOCALCOMPUTER,
      or also list the computer local certificates when using the Windows-MY store type.
      ACTUAL -
      Listing the certificates using the Windows-MY keystore only retrieves the user cerficiates, excluding the local computer certificates.

      ---------- BEGIN SOURCE ----------
      // first make sure to have a computer certificate installed in the windows local computer keystore
      // use the certificate managament console if necessary (MMC), select the certificates component, then select computer account instead of user account
      // then this code will list the certificates found by the SunMSCAPI provider

      try {
      KeyStore ks = KeyStore.getInstance("Windows-MY");
      ks.load(null, null) ;
      Enumeration<String> en = ks.aliases() ;

      while (en.hasMoreElements()) {
      String aliasKey = (String)en.nextElement() ;
      X509Certificate c = (X509Certificate)ks.getCertificate(aliasKey) ;
      System.out.println("---> alias : " + aliasKey) ;
      System.out.println(" Certificat subjectDN : " + c.getSubjectDN() ) ;
      System.out.println(" Certificat issuerDN : " + c.getIssuerDN() ) ;
      }

      } catch (Exception e) {
      e.printStackTrace();
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              macarte Mat Carter
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: