Solved

How to load a pkcs12 file in to KeyStore object?

Posted on 2008-06-12
4
1,594 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SCSM reports export 1 53
Exchange2013 MAPI 6 67
Rensome / malware protection 9 73
Github api to fetch the number of collaborators in a git repo 1 31
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

726 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