Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private key import problems #36

Open
Lan5alot opened this issue Sep 25, 2024 · 2 comments
Open

Private key import problems #36

Lan5alot opened this issue Sep 25, 2024 · 2 comments

Comments

@Lan5alot
Copy link

Lan5alot commented Sep 25, 2024

I've been trying to import a private key to the card, enabling import by setting the "DEF_PRIVATE_KEY_IMPORT_ALLOWED" on the master branch & building it using ant with openjdk-17-jdk-headless but I keep getting "Failed to store private key: Card does not support the requested operation".
The command ran is:

pkcs15-init -r "0" -S "key.pem" -a ff -i 01 --pin "777777" -u "digitalSignature,keyEncipherment,dataEncipherment"

I've tried AcosJ 95K, J3H145 and J3R180 cards, but keep getting the same error. I get the feeling I'm missing something, why doesn't this just work, does these cards really all not support private key import?

@philipWendland
Copy link
Owner

Hi, I just tested the key import and it seems to work for me. Can you provide exact reproduction steps and an OPENSC log? The log might contain sensitive data, your PIN etc.

Did you init the card with pkcs15-init --create-pkcs15?

@A4EVA
Copy link

A4EVA commented Feb 2, 2025

Hello, I'm experiencing the same problem here with a J3H145 card. I built the applet from the V1 branch and I enabled the key import with DEF_PRIVATE_KEY_IMPORT_ALLOWED=true in the source. The applet builds fine and I was able to load the cap without problems. I then used the pkcs15-init --create-pkcs15 to setup the card with the user pin and the puk. I then tried to load a private key with pkcs15-init --store-private-key a4eva.key --label a4eva_key --auth-id 01 --id 01 --pin 000000 but the operation failed with:

Using reader with a card: ACS ACR39U ICC Reader 00 00
Failed to store private key: Card command failed

I do not understand what I'm doing wrong here, I really hope someone can help me a bit

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

No branches or pull requests

3 participants