Skip to content

Support self-signed certificate #205

@devnibo

Description

@devnibo

My Problem

I generated a self-signed certificate and tried using that to connect via TLSv1.3 to a server written with libtls from libressl (written by me; just a test project).

When connecting/reading to/from the server I get the following error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidCertificate(Other(CaUsedAsEndEntity))', src/lib.rs:84:36

where the line src/lib.rs:84 contains client.process_new_packets().unwrap();. client is a ClientConnection.

The reason for this error seems to be that I use a self-signed certificate.

My research

In my research I found the issue https://github.com/briansmith/webpki/issues/114 from the original webpki repo. From the discussion in that issue I learn that connecting via a self-signed certificate is known to be not supported and that there is more important work to do before implementing it.

My question

Is there a will and time to implement connecting via a self-signed certificate in this repo?

Additional infos

I generated my certificate like this:

openssl req -subj "/CN=192.168.2.30" \
  -x509 -nodes -newkey rsa:4096 -sha256 \
  -config /etc/ssl/openssl.cnf \
  -keyout signed.key -out signed.crt

Running openssl x509 -in signed.crt -noout -text gives the following output:

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            cb:ca:a7:2d:e0:d2:90:44
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=192.168.2.30
        Validity
            Not Before: Nov  4 13:08:18 2023 GMT
            Not After : Dec  4 13:08:18 2023 GMT
        Subject: CN=192.168.2.30
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (4096 bit)
                Modulus:
                    00:e2:af:9b:ee:b7:7d:f2:b8:be:36:be:f7:11:7a:
                    5d:f5:a2:fc:b1:c2:6e:c7:78:23:29:f4:fc:40:7a:
                    3e:da:73:52:ec:66:93:2f:fc:b9:04:a5:d7:9e:af:
                    79:49:8c:2d:45:15:1b:38:da:8b:a5:96:3a:b0:e0:
                    04:c8:e5:6e:1c:fc:f1:97:d1:b7:88:e7:50:3b:d8:
                    e3:bd:bb:34:5e:5e:6f:f6:23:cd:78:ca:3b:07:ba:
                    24:1a:97:23:4b:e7:ea:de:71:e9:54:24:9f:d5:4e:
                    c0:9c:4a:d7:40:46:1a:48:57:c2:df:54:95:73:b3:
                    0d:20:a5:4f:dc:3f:ef:e2:7e:a4:1e:dd:1d:2c:c1:
                    ab:67:49:cc:47:22:aa:de:f7:e5:2b:8d:a6:b8:97:
                    66:72:dc:d6:b2:d8:63:33:f0:26:b3:62:86:e9:e0:
                    7d:63:04:5c:1d:cb:a9:e6:a2:d6:14:26:e0:e4:41:
                    c7:bd:bd:a4:45:d4:a8:84:9f:d8:17:2a:e6:ac:ca:
                    99:b9:4c:a0:2f:90:77:1a:73:24:82:cd:e4:90:79:
                    9e:37:ae:b9:39:ec:f0:09:35:ae:b3:14:25:a9:6f:
                    8b:e9:c7:67:59:89:f6:0d:40:40:ce:fa:62:8a:99:
                    70:85:3e:c7:82:4f:30:b3:79:69:d0:a5:7b:9f:ad:
                    0a:bd:0f:59:41:9e:fc:5d:fd:c2:08:62:c3:1b:58:
                    18:28:c4:2a:ba:8a:6d:1e:d2:27:f9:31:98:89:d6:
                    1b:88:e2:84:f2:bb:33:66:d3:aa:8c:55:0f:7b:9e:
                    0c:9f:cf:29:f4:f0:c2:63:71:29:1d:7a:a1:62:ce:
                    fc:f0:cf:64:a2:55:36:dd:b9:42:c9:18:e2:f8:27:
                    b8:8c:bc:a8:7c:be:fe:3a:a5:dc:fb:e1:88:1b:fe:
                    86:69:90:bd:2f:eb:c4:be:ab:76:1e:94:9a:50:6b:
                    7b:7b:9d:c3:3c:ef:d4:39:3d:6c:bf:6f:c3:a5:27:
                    23:26:5b:b7:65:ee:44:09:eb:5a:22:68:70:72:08:
                    5c:a3:1c:dd:4f:0a:89:48:a0:72:fc:5f:a6:38:41:
                    21:a6:ea:b2:a9:8d:88:1c:e9:68:cc:b2:c4:0c:6f:
                    6c:0e:a4:38:96:08:d9:03:fc:01:f3:3c:9e:5c:21:
                    19:80:62:12:22:ca:f1:c1:38:c5:58:ad:7f:9c:57:
                    45:3e:07:ed:47:d5:63:7f:d0:fb:30:18:6b:06:31:
                    13:3e:7e:11:6c:93:9c:b8:a4:17:00:0e:4e:b9:81:
                    41:0c:03:a3:e8:3f:1c:b7:a5:96:93:1b:8d:65:97:
                    e6:90:f5:05:9c:47:83:c8:b2:7a:e0:9f:27:0e:04:
                    e6:6d:77
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                5B:DC:4F:76:6A:17:19:CD:23:C2:D1:AE:00:C1:F6:AC:3F:4B:FB:6B
            X509v3 Authority Key Identifier:
                keyid:5B:DC:4F:76:6A:17:19:CD:23:C2:D1:AE:00:C1:F6:AC:3F:4B:FB:6B

            X509v3 Basic Constraints: critical
                CA:TRUE
    Signature Algorithm: sha256WithRSAEncryption
         44:1d:60:72:9c:74:16:c4:51:82:e8:9f:2b:0b:25:23:97:10:
         a7:ca:e8:07:8a:62:af:04:2b:97:78:40:5c:de:cb:88:86:8e:
         79:63:35:1b:88:5e:b4:77:39:01:cb:15:ab:b2:a5:ed:52:91:
         93:1c:02:5e:9a:db:31:cf:4e:78:1c:69:e1:51:36:95:26:49:
         e2:2f:bf:8b:86:db:99:57:4b:55:72:15:1a:5d:77:af:0e:fa:
         23:3a:a3:b7:5d:cd:f9:9b:13:65:f0:f5:5c:4a:cf:ec:92:6f:
         22:6b:88:ae:55:f7:05:40:39:74:21:1c:1e:eb:3b:c1:e5:ba:
         af:4d:88:61:88:5c:d2:4a:40:48:45:26:65:1d:74:7d:9a:bc:
         fb:00:89:c9:83:99:68:2f:df:23:6c:5d:e6:86:5a:9d:98:a2:
         94:ef:99:a0:03:be:51:2a:06:a3:84:9b:9d:4a:ee:55:e3:9b:
         2b:0f:72:1c:e0:f0:62:f7:0c:bc:3d:75:c3:88:41:59:ae:41:
         46:12:54:73:7b:9e:0c:c2:55:6a:fb:9a:2b:69:44:2e:81:ad:
         1b:b5:ce:fe:d1:30:fd:3f:e8:79:24:79:b6:91:f7:73:0d:f3:
         06:d1:b9:fc:6c:42:40:11:99:39:a8:df:bb:8d:02:1a:df:90:
         a1:84:6c:7d:64:46:0e:71:73:fd:cd:9b:44:ef:b3:1d:a3:59:
         32:ff:68:70:ae:6d:aa:eb:99:c5:b6:78:6c:29:80:74:be:19:
         96:6c:8c:11:88:06:d0:75:7f:9e:e6:59:25:a8:26:05:b2:6e:
         c2:f8:eb:a9:58:98:4a:8b:e0:7f:9a:a9:ce:e4:20:91:24:39:
         e6:e3:80:70:ce:2f:17:2c:1d:7f:0a:e9:e8:13:0f:ca:f4:2b:
         b8:a4:0c:5a:c9:34:bf:46:48:b1:14:36:d9:fc:bf:7f:9d:a4:
         43:55:c5:6e:35:74:5d:83:d1:3b:9d:70:88:68:72:c8:60:39:
         aa:f2:ae:19:fa:14:e5:7d:f2:a5:bd:b1:a2:04:47:45:08:4d:
         77:ef:f4:16:a4:4b:aa:6b:e0:ff:6c:61:06:9a:2f:a4:65:eb:
         ed:ab:06:61:ee:a7:55:cc:c7:af:43:3a:46:6f:65:2e:ce:4e:
         07:13:2f:8f:51:47:0c:f4:56:7a:ff:51:4a:24:5d:46:e7:6b:
         8f:84:f4:5a:67:6f:4f:29:0f:fe:20:62:aa:9e:0b:19:6e:64:
         db:64:1e:b4:5f:2c:fc:a0:99:bb:48:1a:f8:f0:9e:18:ff:9d:
         4d:a4:fb:99:2a:f8:df:ce:83:84:3a:b6:9a:b8:08:dc:3f:60:
         fe:be:a2:9b:7c:a8:9f:3f

If there is something I can further do or test, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions