Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   CodeSigning mit crt-Dateien (https://www.delphipraxis.net/215843-codesigning-mit-crt-dateien.html)

bcvs 16. Sep 2024 13:24

CodeSigning mit crt-Dateien
 
Hallo zusammen,

mein Codesigning-Zertifikat war abgelaufen und ich habe es erneuert. Jetzt habe ich von DigiCert 3 Dateien bekommen:
MeinName.crt, DigiCertCA.crt und TrustedRoot.crt.

Wie bringe ich jetzt dem SignTool bei, dass es dieses Zertifikat nutzt?

Bisher hatte ich eine p12-Datei und diese Commandozeile verwendet (in InnoSetup hinterlegt:
signtool.exe sign /f MeinName.p12 /p MeinPasswort /du https://www.MeineWebseite.de /t "http://timestamp.digicert.com" $p

Signtool kann anscheinend mit den crt-Dateien nichts anfangen (oder doch?). Meine Umwandlungsversuche sind bisher auch fehlgeschlagen.

hans65 16. Sep 2024 15:24

AW: CodeSigning mit crt-Dateien
 
Mir wurde vom Zertifikatsverkäufer (ssl2buy) damals die Erstellung mittels folgender Webseite empfohlen: sslshopper ssl-converter.html
Achtung: Das hat vor 1.5 Jahren funktioniert. Die Seite ist aber jetzt anscheinend unsicher. Bitte nicht verwenden.
Ich lass den Text trotzdem mal stehen, vielleicht findest du ja eine ähnliche Seite.

Kas Ob. 16. Sep 2024 15:54

AW: CodeSigning mit crt-Dateien
 
Zitat:

Zitat von hans65 (Beitrag 1541044)
Mir wurde vom Zertifikatsverkäufer (ssl2buy) damals die Erstellung mittels folgender Webseite empfohlen: https://www.sslshopper.com/ssl-converter.html

Wait !, that is wrong, and never convert your certificates online under any circumstance.

Zitat:

Zitat von bcvs (Beitrag 1541036)
Wie bringe ich jetzt dem SignTool bei, dass es dieses Zertifikat nutzt?

I was expecting who can explain this in German because this is like 101 for certificate and signing.

.crt/.cer file is a certificate, that simple.
.p12 (also practically is .pfx) is also a certiciate same as .crt, But encrypted and most likely have the private key !

Now to sign, meaning to make a signature you need a private key, and that is it, with or without a certificate, for digital signature for Microsoft Authnticode, you need the certificate along the private key.

the certificate you received are the plain one with the chain of trust, ( the root, and CAs in your case there is only one CA).

Now the question is : and this is what you should have asked : Where is my Private Key ?
The quick answer is i don't know ! and i can't say !

However i can this:
Either it is attached to PKCS11 meaning will need hardware token/USB, or simply it is already imported in your OS store, or you used a (the specific) browser to receive the certificate and the key was imported in that store, like the case with FireFox, ( i use portable version of FireFox ESR, https://portableapps.com/apps/intern...x-portable-esr to handle my online certified presence and certificates).

Anyways, if you have hardware token then, i believe others here would be more helpful, in case you can open your OS store and check if that certificate is imported in personal and there is private key then you can use SignTool, but first i want to point that private key from OS certificate store, might be exportable !
If they imported at first with exportable flag then you can export it and build/convert your crt and the key into either pfx or p12, but if it is non exportable then you limited to use it on your device (account!!) as user.
if case non exportable then you use
Code:
#signtool.exe sign /f MeinName.p12 /p MeinPasswort /du https://www.MeineWebseite.de /t "http://timestamp.digicert.com" $p
signtool.exe sign /a /n "ISSUED_TO_FIELD" /du https://www.MeineWebseite.de /t "http://timestamp.digicert.com" $p
where ISSUED_TO_FIELD is from the certificate and will be shown in the store, while "/a" will select the certificate automatically.

Hope that help, and a i said someone with German might explain this in cleaner way.

TomyN 16. Sep 2024 17:50

AW: CodeSigning mit crt-Dateien
 
Ich habe das Zertifikat im Windows Zertifikatspeicher und so wird es vom Signtool direkt aufgerufen. Das funktioniert (in innosetup, extern hab ich es noch nicht probiert) wunderbar.

bcvs 17. Sep 2024 07:11

AW: CodeSigning mit crt-Dateien
 
OK,
das Zertifikat ist jetzt im Zertifikatsspeicher\Aktueller Benutzer\Eigene Zertifikate\Zertifikate

Commandozeile ist:

Code:
signtool.exe" sign /a /n "MeinName (Ausgestellt für)" /du https://www.MeineWebseite.de /t "http://timestamp.digicert.com" $p
Ergebnis:
SignTool Error: No certificates were found that met all the given criteria.

Was läuft da falsch?

Kas Ob. 17. Sep 2024 10:09

AW: CodeSigning mit crt-Dateien
 
Liste der Anhänge anzeigen (Anzahl: 2)
Zitat:

Zitat von bcvs (Beitrag 1541061)
OK,
das Zertifikat ist jetzt im Zertifikatsspeicher\Aktueller Benutzer\Eigene Zertifikate\Zertifikate

Commandozeile ist:

Code:
signtool.exe" sign /a /n "MeinName (Ausgestellt für)" /du https://www.MeineWebseite.de /t "http://timestamp.digicert.com" $p
Ergebnis:
SignTool Error: No certificates were found that met all the given criteria.

Was läuft da falsch?

This only will work if the store has also the private key for this certificate !
You can check for the small key icon in the store, or open the certificate and it will the private key do exist and stored like these screenshots
Anhang 57111
Anhang 57112

Kas Ob. 17. Sep 2024 10:15

AW: CodeSigning mit crt-Dateien
 
Also notice my old and expired Sectigo issued certificate doesn't have key, as i didn't imported it, so can't be used for signing automatically.

while my Kas issued by Kas is root one and does have key, but it is not for code signing, it is for different usage, and IIS will automatically use/offer it for localhost on my device.

bcvs 17. Sep 2024 13:34

AW: CodeSigning mit crt-Dateien
 
My certificate doesn't show this private key. And I dont't know even if I have a private key. I have a passwort that I used with the old p12 certificate.

From where do I get a private key?

jaenicke 17. Sep 2024 13:46

AW: CodeSigning mit crt-Dateien
 
Ich kenne DigiCert nicht, aber vielleicht hilft das DigiCert Certificate Utility weiter? Ansonsten kannst du auch deren Hotline anrufen oder den Support schriftlich kontaktieren. Soweit ich gehört habe, antworten die recht schnell.

rwalper 17. Sep 2024 14:05

AW: CodeSigning mit crt-Dateien
 
Seit 01.06.2023 dürfen Paare von privaten und öffentlichen Schlüsseln nur noch über Hardware-Sicherheitsmodule (USB-Stick, Crypto-Card) ausgeliefert werden.
Du hast damit keinen Zugriff mehr auf den privaten Schlüssel, der bleibt im Hardwaremodul.
Aber für diese Module gibt es Software/Treiber, die das MS-Signtool ansprechen und damit auch die Software signaieren kann.
Alle notwendigen Infos solltest du auf der Webseite des Zertifikatsanbieter finden.


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:16 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz