1

Here's my problem: I'm trying to enable HTTPS on a local site for learning reasons. The thing is, I don't want to generate the certificate with some well-known application, but i want to create a homemade one. I made a self signed certificate because I don't need any chain of trust.

The .crt I made:

$ openssl x509 -in server.crt -text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            06:31:4c:1a:04:d2:19:e4:eb:6c:a7:6f:47:74:63:67:b4:ac
    Signature Algorithm: rsassaPss
         Hash Algorithm: sha256
         Mask Algorithm: mgf1 with sha256
         Salt Length: 0x20
         Trailer Field: 0x01
        Issuer: C=FR, ST=Aquitaine, L=Bordeaux, O=Cyebrens, OU=Cyberens Test, CN=192.168.2.149
        Validity
            Not Before: Apr  6 12:36:16 2018 GMT
            Not After : Apr  6 12:36:16 2019 GMT
        Subject: C=FR, ST=Aquitaine, L=Bordeaux, O=Cyebrens, OU=Cyberens Test, CN=192.168.2.149
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:8c:7c:3c:68:f6:0d:d1:eb:64:df:a2:4d:1a:0b:
                    65:6c:27:15:c3:a5:33:3e:59:78:63:c3:21:62:6c:
                    73:35:dc:ff:02:8f:b8:d8:01:7f:97:4d:a3:90:8e:
                    3d:90:49:af:65:12:66:19:e7:35:1d:ee:de:ee:98:
                    8f:68:12:6d:6c:fc:a6:41:bd:72:f6:39:dd:55:63:
                    50:98:e5:d9:72:3d:32:55:5b:ca:21:1a:97:3c:af:
                    bb:85:1c:32:a2:dc:7c:ae:48:15:5a:ad:f9:00:47:
                    16:89:b9:14:30:85:06:cb:1e:80:c7:ec:5c:d4:d5:
                    72:90:37:67:4b:70:0c:2f:05:ae:de:1b:2c:cb:9c:
                    3a:93:2c:5e:54:8b:72:67:42:eb:b9:dc:bd:83:e8:
                    cd:40:55:17:4a:59:08:80:6e:81:e7:74:e5:70:47:
                    40:d9:d3:d5:d2:77:7b:8f:84:d9:18:75:ea:d3:f3:
                    2c:f1:8a:8a:bf:40:0a:c1:1c:4f:52:41:31:ca:93:
                    88:2f:31:68:52:59:4d:60:a1:14:e8:31:0f:db:54:
                    87:bd:27:1d:55:b5:fa:a4:98:24:06:f2:93:c4:85:
                    58:ec:57:7a:b9:8d:1b:1a:ef:9d:85:f8:df:89:29:
                    5c:2c:d3:32:42:15:75:14:4f:b9:36:33:fc:62:54:
                    47:13
                Exponent:
                    40:00:10:00:40:20:00:00:08:00:00:02:00:00:00:
                    00:00:00:00:00:00:00:00:00:00:00:d7
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                01:02:06
            X509v3 Authority Key Identifier:
                keyid:01:02:06

            X509v3 Basic Constraints:
                CA:TRUE
    Signature Algorithm: rsassaPss
         Hash Algorithm: sha256
         Mask Algorithm: mgf1 with sha256
         Salt Length: 0x20
         Trailer Field: 0x01

         24:b8:30:d6:7e:49:a7:cc:a0:77:e1:b6:cd:37:70:18:74:1b:
         1f:17:61:a4:f7:47:22:f5:50:ee:e7:c8:4f:2c:55:a8:7a:e8:
         16:63:ae:28:72:ab:2e:b2:98:7c:c9:9f:6c:a6:22:94:04:7b:
         c6:f2:15:4e:9b:f1:b7:0f:9b:7d:d2:e4:b7:b0:0f:b6:7d:2e:
         f9:64:b7:ce:cf:bd:51:7e:ae:96:7e:54:2c:46:a3:8e:87:c6:
         09:cf:4b:f1:18:85:eb:7e:01:a1:71:9b:80:53:d1:ca:c6:a0:
         1c:c7:86:06:0b:9b:70:40:62:5d:49:13:82:1f:1f:34:36:4f:
         91:91:e0:e2:1b:b4:ab:4d:a9:5e:ff:f5:be:ec:e0:e9:62:6d:
         bf:9d:6a:45:66:19:f0:54:4a:83:e4:ca:21:d2:a7:0e:c1:33:
         ed:6f:bb:3c:d1:9f:0f:e2:19:18:a5:d9:be:61:c4:7c:cd:03:
         d0:fa:be:31:57:8e:59:45:f3:90:00:79:0e:eb:0e:61:94:e0:
         95:ca:8d:8d:9a:02:84:a1:26:23:b4:ca:57:43:a1:0f:79:0c:
         12:27:e9:9f:74:da:88:c0:ed:76:2d:36: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SCe3fhU8Uo
hp6GlXSB9sDgqS88rtx3yK+D0A==
-----END RSA PRIVATE KEY-----

The problem is that I got a "SEC_ERROR_BAD_SIGNATURE" on Mozilla when I try to go on my site. I used a homemade implementation to sign it (RSASSA-PSS), so the problem may come from my implementation.

But when I open the certificate by double clicking on it, the signature seems valid, otherwise I would have some message saying the certificate is corrupted.

So 2 questions:

  1. How can I check that my signature is valid? I can't find any simple way to do that.

  2. If the signature is valid, what is the problem?

10
  • 1
    A certificate can be in a valid format while having an invalid signature. Apr 6 '18 at 17:52
  • 4
    Just as an FYI, but if you ever have a question about a Live system, do NOT post your private keys online ;-)
    – Nomad
    Apr 6 '18 at 18:00
  • Sure I know that. But my RSAPSS signature algorithm didn’t work at first and I knew it because of the corrupted message thing when double clicking on it. Now this message disappeared, and that lets me think that my algorithm is correct. This is the whole point of my question. How can I check that ? Apr 6 '18 at 18:03
  • 1
    Why is your exponent so large? I see 26328173356909017646426704447934393073839397504785168138864951511 in your certificate, whereas a value like 65537 is more typical...
    – David
    Apr 6 '18 at 18:48
  • 1
    openssl verify doesn't check self-signed by default, but 1.1.0 (the current release) has an option -check_ss_sig to do so (and it likes your cert). Apr 7 '18 at 3:33
3

I used a homemade implementation to sign it (RSASSA-PSS), so the problem may come from my implementation.

RSASSA-PSS is currently not supported by Firefox. See this issue for more information. If in doubt look at the signature_algorithm extension in the TLS 1.2 handshake where it advertises which algorithms are supported.

4
  • Sigalgs for 1.2 can't specify RSASSA-PSS, only RSASSA-PKCS1-v1_5. 1.3 proposes to change this -- and to use only PSS for in-protocol RSA signatures -- but is not yet standard. Apr 7 '18 at 3:39
  • @dave_thompson_085 Sigalgs is for the signature of the handshake. Certificates can use other algorithms. Apr 9 '18 at 16:28
  • @Gilles: nope. rfc5246 7.4.2: If the client provided a "signature_algorithms" extension, then all certificates provided by the server MUST be signed by a hash/signature algorithm pair that appears in that extension. 1.3 draft-28 4.4.2.2 says almost the same, but it excludes anchor including selfsigned (which doesn't need to be verified) and allows server to try something else only if it cannot comply with client offer. Apr 10 '18 at 3:36
  • 1
    @Gilles: in addition to the comment from dave_thompson_085: TLS 1.3 (draft 28) adds a signature_algorithms_cert extension specifically designed to allow different algorithms for certificate validation than for the other signature operations and recommends TLS 1.2 clients to also look for this extension. Absent this extension signature_algorithms is used as before, i.e. for all use cases including certificate validation. Apr 10 '18 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.