Solved

Multiple certs with same alias in keystore causes problem

Posted on 2011-03-03
9
2,206 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 82
thymeleaf natural templating vs JSP 2 95
difference of if loops 23 49
Error in @AspectJ Based AOP with Spring 2 13
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now