Solved

How to load a pkcs12 file in to KeyStore object?

Posted on 2008-06-12
4
1,589 Views
Last Modified: 2013-12-22
I'm not able to extract my private key from pkcs12 file which was loaded in to KeyStore object .

ksp = KeyStore.getInstance("PKCS12");

            fis = new FileInputStream(policyFile);

            ksp.load(fis, null);

      System.out.println("size of the ksp::"+ksp.size());//---- return 0
 

            char[] privateKeyPassword = access_policy.toCharArray();

            

            PrivateKey key = (PrivateKey) ksp.getKey("XXXXX"

                    + access_policy.toLowerCase(), privateKeyPassword);

            Signature s = Signature.getInstance("SHA1withRSA");

            s.initSign(key);

Open in new window

0
Comment
Question by:vpram86
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
mbodewes earned 125 total points
Comment Utility
Have you tried filling in the password in the load() method instead? PKCS#12 is a password encrypted file, so I am wondering if just supplying the password for the key alias works (my guess is not, please reply if this doesn't work, I'll look for my PKCS#12 code at work).
0
 
LVL 9

Expert Comment

by:mbodewes
Comment Utility
Hello?
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Big data transfers via information superhighways require special attention and protection. Learn more about the IT-regulations of the country where your server is located. Analyze cloud providers and their encryption systems for safe data transit. S…
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

771 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