Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

The exported .p12 file can not be imported into Windows #1

Closed
ssonow opened this issue Jun 4, 2016 · 7 comments
Closed

The exported .p12 file can not be imported into Windows #1

ssonow opened this issue Jun 4, 2016 · 7 comments
Assignees

Comments

@ssonow
Copy link

ssonow commented Jun 4, 2016

Error is : an internal error occurred. Either the user profile is not accessible or the private key that you are importing might require a cryptographic service provider that is not installed on your system.

Need to change java.security?

@olivierlemasle
Copy link
Owner

Hi,

This exact error message is referenced here: https://support.microsoft.com/en-us/kb/919074
Could you please check the three causes and possible resolutions and tell me if it helped?

Thanks!

@ssonow
Copy link
Author

ssonow commented Jun 5, 2016

Have you tried to load it into OS yourself? I have tried MAC and Windows,
none worked.

I have attached code and one bad output. Password is "password".

Thanks!

On Sat, Jun 4, 2016 at 8:35 PM, Olivier Lemasle notifications@github.com
wrote:

Hi,

This exact error message is referenced here:
https://support.microsoft.com/en-us/kb/919074
Could you please check the three causes and possible resolutions and tell
me if it helped?

Thanks!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADdmx_qpDSjUj6y2NEbq5q969Qb6IGt6ks5qIXEWgaJpZM4IuCha
.

@olivierlemasle
Copy link
Owner

Yes, I tried and it works. Your code and output were not attached to GitHub issue. Can you please paste it directly in the issue?

@olivierlemasle
Copy link
Owner

Simple example:

import static io.github.olivierlemasle.ca.CA.createSelfSignedCertificate;
import static io.github.olivierlemasle.ca.CA.dn;

import io.github.olivierlemasle.ca.DistinguishedName;
import io.github.olivierlemasle.ca.RootCertificate;

public class Main {

  public static void main(final String[] args) {
    final DistinguishedName root = dn("CN=Root-Test, O=My Org");
    final RootCertificate ca = createSelfSignedCertificate(root)
        .validDuringYears(10)
        .build();
    ca.exportPkcs12("root.p12", "password".toCharArray(), "test");
  }
}

I successfully read it on my main OS (Linux Fedora).
Now, on Windows 10:

2016-06-05 12_31_33-clipboard

Then I select "Local Machine", then the root.p12 path, then:

2016-06-05 12_35_08-

Then I choose the store (Personal in my case), and review the settings.
And finally:

2016-06-05 12_37_44-certificate import wizard

2016-06-05 12_38_05-certlm - certificates - local computer_personal_certificates

I can now check that the SSL certificate is imported, along with the private key.

@monkeyk
Copy link

monkeyk commented Sep 29, 2017

Suggest more OS platform testing @olivierlemasle
i had the same issue when import certificate(.p12 file) on Win7 and MAC,
but import on Win10 is OK, why?? confused.

win7 error: http://andaily.com/dd/win7_error.png
Mac error: http://andaily.com/dd/mac_error.png

@monkeyk
Copy link

monkeyk commented Sep 29, 2017

I found the issue and update it
keyStore.setKeyEntry(alias, privateKey, keystorePassword, chain);
must set keystorePassword

and when load from Keystore, add password
final PrivateKey privateKey = (PrivateKey) keystore.getKey(alias, password);

@olivierlemasle
Copy link
Owner

Closing as I archive this unmaintained project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants