Bonjour,

Je ne maitrise pas trop tout ce qui est certificat, mais je dois dans un système générer des certificat avec la clé sous linux (sur un raspberry) qui soient identique à des certificats déjà généré sous windows.

De ce que j'ai compris ,c'est que les certificats générés sous windows le sont avec l'outil "makecert.exe" qui a l'air un peu obsolète de ce que je lis ici https://learn.microsoft.com/fr-fr/wi...rypto/makecert

Les certificats et clés générés sous windows sont sous la forme de 2 fichiers texte : certifcate.txt et key.txt

sudo openssl x509 -in /home/pi/IFS2/System/Install/FirstInstaller/testA.txt -text -noout

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
             (Negative)7f:1b:14:51:6e:f1:5d:64:bd:82:48:0d:03:5e:d1:3b                     ====> que signifie ce "negative"
        Signature Algorithm: sha1WithRSA
        Issuer: CN = COMP_Equipment_40403
        Validity
            Not Before: Mar 20 15:05:21 2024 GMT
            Not After : Mar 20 15:05:20 2026 GMT
        Subject: CN = COMP_Equipment_40403
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (1024 bit)
                Modulus:
                    00:ba:cf:d6:1c:4d:54:49:b1:d0:b6:5e:a7:f9:88:
                    9e:50:a7:38:c9:e1:3d:b9:e9:c5:3c:a2:6b:8f:be:
                    fb:66:c2:68:76:6b:a3:0a:ca:6d:03:6d:8b:e0:59:
                    32:e7:a5:05:dc:3d:5c:ef:fe:4f:ba:a6:13:6b:ce:
                    bf:6a:a8:40:f4:5f:83:fc:17:70:14:d2:f7:94:5a:
                    20:44:a7:1c:f0:a8:b5:da:0c:a1:ee:7d:e3:d4:46:
                    3d:f9:8f:82:e0:c0:e3:67:cf:14:e7:16:64:40:f9:
                    46:0c:f5:99:0c:18:73:7b:cf:7f:ff:d5:26:e2:f3:
                    fe:5c:c6:6b:9b:a8:9f:83:c1
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            2.5.29.1:
                0]..m..NTX.../....r..7051301..U...*.C.O.M.P._.E.q.u.i.p.m.e.n.t._.4.0.4.0.3..........B}......
    Signature Algorithm: sha1WithRSA
         4f:3a:05:5b:6f:91:bf:6f:82:b4:80:10:cc:7d:a0:fa:db:95:
         e5:8c:9a:e4:70:28:a1:50:48:4c:ba:d9:dc:87:d3:b5:68:19:
         29:c7:8d:c8:27:e9:b6:a2:65:79:c1:98:93:a0:24:c4:39:31:
         12:d6:b9:35:46:68:51:dd:fa:ad:2a:10:3e:f0:62:67:e1:e7:
         72:fe:12:7d:60:8c:8e:7c:39:09:a0:d7:d5:95:91:31:30:86:
         f9:20:f9:eb:13:2c:06:b5:69:40:bb:c8:fd:c7:8d:b4:97:55:
         14:45:c9:45:04:6e:e8:ba:ee:50:6c:5e:c2:5f:7d:cb:7b:57:
         be:2e


Pour le fichier clé, je ne sais pas trop comment visualiser sont contenu (ou ses caracteristiques) les seuls choses que j'obtient sont les suivantes:

sudo ssh-keygen -lf testB.txt
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'testB.txt' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
testB.txt is not a key file.
sudo openssl rsa -text -noout -in testB.txt
u
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
nable to load Private Key
4156497984:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:../crypto/asn1/asn1_lib.c:101:
4156497984:error:0D068066:asn1 encoding routines:asn1_check_tlen:bad object header:../crypto/asn1/tasn_dec.c:1137:
4156497984:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:309:Type=PKCS8_PRIV_KEY_INFO
4156497984:error:0907B00D:PEM routines:PEM_read_bio_PrivateKey:ASN1 lib:../crypto/pem/pem_pkey.c:88:


Du coup comment arriver à générer un jeu certificat + clé avec les mêmes caracteristiques que ceux-ci.

J'ai essayé avec cette commande, mais je ne retombe pas exactement sur le meme resultat:

sudo openssl req -newkey rsa:1024 -x509 -sha1 -days 730 -nodes -out certificate.txt -keyout key.txt

ce qui donne:



ubuntu@ubuntu-VirtualBox:/media/ubuntu$ sudo openssl x509 -in certificate.txt -text -noout

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Certificate:

    Data:

        Version: 3 (0x2)

        Serial Number:

            33:ef:05:54:58:d7:a7:e6:11:a3:85:f3:4f:fb:59:b5:10:44:fc:86

        Signature Algorithm: sha1WithRSAEncryption

        Issuer: CN = COMP_Equipment_40403

        Validity

            Not Before: Mar 10 19:50:19 2025 GMT

            Not After : Mar 10 19:50:19 2027 GMT

        Subject: CN = COMP_Equipment_40403

        Subject Public Key Info:

            Public Key Algorithm: rsaEncryption

                Public-Key: (1024 bit)

                Modulus:

                    00:b1:0d:2c:2b:19:09:4e:e0:4c:9a:b5:9a:86:10:

                    bf:70:8e:25:46:93:05:df:37:05:f5:72:bb:57:6a:

                    4c:92:39:38:9b:5b:00:82:2b:e5:55:16:02:88:00:

                    02:aa:ef:07:91:09:bd:57:66:2b:36:c8:f3:b4:b7:

                    1b:72:ec:12:2f:a0:7b:0b:15:28:db:37:64:f1:a2:

                    2d:da:84:c8:32:5a:8a:d2:10:70:ba:de:48:35:31:

                    41:84:86:92:44:1a:93:08:2a:aa:be:bc:d2:d3:b1:

                    0c:5e:98:cc:9f:41:35:43:2a:3c:c9:5b:59:5d:8e:

                    51:70:e9:6d:56:21:69:7a:35

                Exponent: 65537 (0x10001)

        X509v3 extensions:

            X509v3 Subject Key Identifier: 

                9E:B8:23:1F:F9:02:31:67:DF:1B:74:76:7D:37:BF:E0:ED:24:F2:11

            X509v3 Authority Key Identifier: 

                9E:B8:23:1F:F9:02:31:67:DF:1B:74:76:7D:37:BF:E0:ED:24:F2:11

            X509v3 Basic Constraints: critical

                CA:TRUE

    Signature Algorithm: sha1WithRSAEncryption

    Signature Value:

        0d:94:95:93:c7:af:29:d0:3f:0a:1a:2a:c6:18:f7:9b:fa:ad:

        44:59:b8:25:6e:82:16:60:12:ca:f9:20:37:09:3e:11:34:8a:

        ae:4b:e0:66:26:ef:05:23:e4:41:11:c5:7e:ba:b7:ac:e5:03:

        43:ec:66:47:57:42:43:aa:21:f3:c5:d2:cd:24:d4:8d:0f:eb:

        e7:ae:29:e5:91:c3:b1:0e:00:ba:c6:14:4a:dd:56:53:58:2c:

        6c:37:f1:c1:fa:3c:0f:4b:f3:90:25:fd:45:4a:2b:c9:2b:93:

        c7:b6:40:07:b7:f3:52:8d:59:3b:ad:60:fe:c2:09:ac:9f:ad:

        14:c5
Et la clé que du coup j'arrive à lire:

sudo ssh-keygen -lf key.txt

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1024 SHA256:q4Gi34H9CeNIjPyihUwdB/3tISjePfsm9sP1F2u1Afo no comment (RSA)



Merci