Solved

Multiple certs with same alias in keystore causes problem

Posted on 2011-03-03
9
2,333 Views
Last Modified: 2012-05-11
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
Comment
Question by:endasil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 35029673
Why would you give certs the same alias?
0
 

Author Comment

by:endasil
ID: 35029785
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 35029899
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
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 

Author Comment

by:endasil
ID: 35030479
Yes that one enumerates duplicated aliases.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35030535
0
 

Author Comment

by:endasil
ID: 35030623

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
 
LVL 86

Expert Comment

by:CEHJ
ID: 35030812
Not sure if this is possible
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 35031098
> 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
 

Author Closing Comment

by:endasil
ID: 35031776
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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question