No private key found

Beim Versuch mein Zertifikat auf meinen Nitrokey Pro2 zu installieren.
Bekomme ich folgenden Fehler:

error:11800071:PKCS12 routines::mac verify failure
Please enter passphrase to unlock secret key:
error:0308010C:digital envelope routines::unsupported
error: Unable to read private key from mycertifikate.p12

Systeminfo:
Linux Mint 21, codename Vanessa
opensc: 0.22.0-1ubuntu2
pcscd 1.9.5-3
scdaemon 2.2.27-3ubuntu2.1
gpg 2.2.27-3ubuntu2.1

Hi,

auf welche Art und Weise wolltest du das Zertifikat installieren?
Ich kann dann versuchen das Problem zu reproduzieren.

Viele Grüße
Simon

Vorab habe ich das Zertifikat im Firefox (105.0.1), Chrome (106.0.5249.61) und Thunderbird (91.11.0) importiert.
Dann ein Backup davon gemacht.
Ebenfalls sind die Zertifikate der Zertifizierungsstelle cacert.org importiert (CAcert Class 3 Root und CA Cert Signing Authority) sowie die entspechenden Häckchen für das Vertrauen gesetzt.

pkcs15-init --delete-objects privkey,pubkey --id 3 --store-private-key /meinpfad/meinzertifikat.p12 --format pkcs12 --auth-id 3 --verify-pin –

Jetzt ist mir noch durch Zufall aufgefallen, dass die Zertifkate zwar in den Browsern, Thunderbird importiert sind aber NICHT im System selbst! Ich habe das Importieren im System jetzt nachgeholt
Stammzertifate von cacert.org heruntergeladen. Für Linux Mint:

  1. Zertifikate an die richtige Stelle ins System kopiert:
    sudo cp Downloads/root_X0F.crt /usr/share/ca-certificates/mozilla
    sudo cp Downloads/CAcert_Class3Root_x14E228.crt /usr/share/ca-certificates/mozilla/
  2. Vertrauen der neuen Zertifkate gesetzt:
    sudo dpkg-reconfigure ca-certificates
  3. Zertifikatsliste im System upgedatet:
    sudo update-ca-certificates

Ich versuche es mit dem Imporieren auf dem Stick noch mal, vielleicht war das der Fehler.

Ich habe es noch mal versucht.
Immer noch der gleiche Fehler.

Was sagen die folgenden Kommandos?

openssl pkcs12 -in /meinpfad/meinzertifikat.p12 -info -noout

openssl pkcs12 -in /meinpfad/meinzertifikat.p12 -info -nocerts -nodes | openssl pkey -text_pub -pubout

Hallo seper,
fogende Fehlermeldung habe ich bekommen:

MAC: sha1, Iteration 600000
MAC length: 20, salt length: 16
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 600000
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 600000
Error outputting keys and certificates
…B277F0000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:…/crypto/evp/evp_fetch.c:349:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
Could not read key from

I found this link on github.com/openssl: issue 12227](pkcs12 error · Issue #12227 · openssl/openssl · GitHub).
And I found also this topic on stackoverflow.com/questions: Convert an old style .p12 to .pem (unsupported algorithm RC2-40-CBC).
As an “enduser” at this point I am lost.

Following the advice you have found what could be done is to convert the file you have encrypted with an ancient cipher to something modern:

openssl pkcs12 -in /meinpfad/meinzertifikat.p12 -nodes -legacy | openssl pkcs12 -export -out /meinpfad/neu.p12

Didn’t test it with 3.0 but might work. This will also decrypt your private key for a brief moment and pass it to another openssl command. Then you can try importing neu.p12

(This whole issue has nothing to do with Nitrokeys, it is about PKCS#12 format and breaking changes in OpenSSL 3.0)