[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2693
  • Last Modified:

Multiple certs with same alias in keystore causes problem

To load a certificate on my computer into java  i can use the following code:

ks = KeyStore.getInstance("Windows-My");
X509Certificate cert = (X509Certificate)ks.getCertificate(aliasKey);

The problem is that there are multiple certificates in the store with the alias auth or sign, and by passing in "auth" i simply get the first one. Is there another way of doing this that can handle multiple certificates with same alias?
0
endasil
Asked:
endasil
  • 4
  • 4
1 Solution
 
CEHJCommented:
Why would you give certs the same alias?
0
 
endasilAuthor Commented:
They are just a bunch of certs that i have imported to my computer by double clicking them, i was not the one choosing their names.
0
 
CEHJCommented:
If you use

http://download.oracle.com/javase/6/docs/api/java/security/KeyStore.html#aliases()

does it enumerate them all (allowing dup aliases)?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
endasilAuthor Commented:
Yes that one enumerates duplicated aliases.
0
 
CEHJCommented:
0
 
endasilAuthor Commented:

GetCreationDate(String alias) will get the time for the first certificate with that alias in the store. How could i get the date for the second, third or fourth?

0
 
CEHJCommented:
Not sure if this is possible
0
 
objectsCommented:
> Is there another way of doing this that can handle multiple certificates with same alias?

no there isn't.
you'll need to copy them into a new store and give them unique names
0
 
endasilAuthor Commented:
Thank you for that response objects, and thank you CEHJ for taking your time to try to help.


If any of you guys know the answer to this problem, i would be very happy. :) http://www.experts-exchange.com/Programming/Languages/Java/Q_26861809.html
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now