Solved

How to load a pkcs12 file in to KeyStore object?

Posted on 2008-06-12
4
1,592 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
ID: 21771455
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
ID: 21912627
Hello?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
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.

839 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