Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Import p12 file using keytool

Posted on 2008-09-29
1
Medium Priority
?
7,903 Views
Last Modified: 2013-11-23
I was just given a p12 file and told to import this file into my keystore.  I've tried a couple of different methods using keytool, but I get errors.  I'm sure I'm using it wrong, but was hoping that someone could point me in the right direction.  Thanks

C:\test>keytool -keystore "C:\Program Files\Java\j2re1.4.2_01\lib\security\cacer
ts" -import -file giftcards.p12 -storetype pkcs12 -trustcacerts -alias TestCert
keytool error: java.io.IOException: DerInputStream.getLength(): lengthTag=109, t
oo big.

0
Comment
Question by:jhughes4
1 Comment
 
LVL 5

Accepted Solution

by:
muktajindal earned 2000 total points
ID: 22603177
You may use an alternate approach. Get a .cer equivalent for this p12 file and then import that .cer file to your keystore.

- Open IE. Go to Tools --> Internat Options --> Content --> Certificates.
- Click on "Import". Certificate Export Wizard window will be opened. (This window may also be opened by directly double-clicking on p12 file)
- Import p12 file here.
- After successful import, it will be listed in the certificates list.
- Select it. "Export" button will be enabled. Click on it. Certificate Export Wizard window will be opened.
- In the format option, select DER encoded binary X.509 (.CER)
- Finally, you will have a .cer file, say giftcards.cer.
- Import it into your keystore using following command :
keytool -keystore "C:\Program Files\Java\j2re1.4.2_01\lib\security\cacerts" -import -file giftcards.cer -trustcacerts -alias TestCert

HTH,
Mukta.
0

Featured Post

When ransomware hits your clients, what do you do?

MSPs: Endpoint security isn’t enough to prevent ransomware.
As the impact and severity of crypto ransomware attacks has grown, Webroot has fought back, not just by building a next-gen endpoint solution capable of preventing ransomware attacks but also by being a thought leader.

Question has a verified solution.

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

Encryption for Business Encryption (https://en.wikipedia.org/wiki/Encryption) ensures the safety of our data when sending emails. In most cases, to read an encrypted email you must enter a secret key that will enable you to decrypt the email. T…
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

916 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