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

pkcs15-init with Oberthur Cosmo v7 Card: "Failed to store private key: Invalid data" #2693

Closed
scottthomas007 opened this issue Feb 2, 2023 · 4 comments

Comments

@scottthomas007
Copy link

Bonjour,

I am trying to import PKCS12 file in Oberthur Cosmo v7.0 smart card but it fails with the error "Failed to store private key: Invalid data"
The verbose command shows the following output:

[pkcs15-init] pkcs15-authentic.c:692:authentic_pkcs15_store_key: Invalid PrKey SDO data: -1305 (Invalid data)
[pkcs15-init] pkcs15-lib.c:1817:sc_pkcs15init_store_private_key: Card specific 'store key' failed: -1305 (Invalid data)
[pkcs15-init] pkcs15-lib.c:1842:sc_pkcs15init_store_private_key: returning with: -1305 (Invalid data)

I am using OpenSC version 0.23.0

Please guide me.

Regards
Scotty

@dengert
Copy link
Member

dengert commented Feb 2, 2023

The code is failing here:
https://github.com/OpenSC/OpenSC/blob/master/src/pkcs15init/pkcs15-authentic.c#L691-L694

Can you get a debug log? See man opensc.conf
What command are you using?

The code is trying to import a private key.
Also see: https://github.com/OpenSC/OpenSC/blob/master/src/pkcs15init/README
Are you using 2 keys?

Where did you get the PKCS12 file?

@scottthomas007
Copy link
Author

The code is failing here: https://github.com/OpenSC/OpenSC/blob/master/src/pkcs15init/pkcs15-authentic.c#L691-L694

Can you get a debug log? See man opensc.conf What command are you using?

The code is trying to import a private key. Also see: https://github.com/OpenSC/OpenSC/blob/master/src/pkcs15init/README Are you using 2 keys?

Where did you get the PKCS12 file?

I had a PKCS12 file, i splitted the private key from the PKCS12 in PEM format.

@dengert
Copy link
Member

dengert commented Feb 6, 2023

What was the command line you used?

https://github.com/OpenSC/OpenSC/blob/master/src/pkcs15init/README says:
"Or, store a pkcs12 key/certificate pair
./pkcs15-init --auth-id 01 -f pkcs12 -S mycert.p12

Note that the pkcs12 file must use just one password - if you
use different passwords for integrity and confidentiality,
OpenSC will fail to import the keys.

"
Why did you split the PKCS12 file?

@frankmorgner
Copy link
Member

Closing this issue due to inactivity. Please re-open the ticket if more input is available.

@frankmorgner frankmorgner closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants