[gnutls-help] new EC cert: Received alert [51]: Decrypt error
Mark Oteiza
mvoteiza at udel.edu
Fri Apr 11 04:39:25 CEST 2014
Nikos Mavrogiannopoulos <nmav at gnutls.org> writes:
> On Thu, Apr 10, 2014 at 1:45 AM, Mark Oteiza <mvoteiza at udel.edu> wrote:
>>
>> Hi,
>> I generated a new EC client certificate to use with IRC. I can use it with
>> s_client, but gnutls-cli fails
>
> I don't believe it works with s_client. Possible s_client doesn't send
> your key. See below.
I believe my key is sent with s_client, but not so with
gnutls-cli. s_client output:
$ openssl s_client -connect chat.freenode.net:7000 -state -debug
-no_ssl2 -ign_eof -CAfile /etc/ssl/certs/ca-certificates.crt
-cert foo.pem
...
SSL_connect:SSLv3 read server certificate request A
SSL_connect:SSLv3 read server done A
write to 0x10b6410 [0x11c1900] (654 bytes => 654 (0x28E))
0000 - 16 03 01 02 89 0b 00 02-85 00 02 82 00 02 7f 30 ...............0
<SNIP>
0280 - e8 60 f0 36 a3 e3 2f 66-36 4b 64 bb f2 91 .`.6../f6Kd...
SSL_connect:SSLv3 write client certificate A
write to 0x10b6410 [0x11c1900] (139 bytes => 139 (0x8B))
0000 - 16 03 01 00 86 10 00 00-82 00 80 99 db 85 34 14 ..............4.
<SNIP>
0090 - be ef f1 7c 54 91 ...|T.
SSL_connect:SSLv3 write certificate verify A
write to 0x10b6410 [0x11c1900] (6 bytes => 6 (0x6))
0000 - 14 03 01 00 01 01 ......
SSL_connect:SSLv3 write change cipher spec A
write to 0x10b6410 [0x11c1900] (53 bytes => 53 (0x35))
0000 - 16 03 01 00 30 59 90 0c-39 eb 85 12 66 c2 d7 ff ....0Y..9...f...
<SNIP>
0030 - 96 1d 1b 25 6b ...%k
SSL_connect:SSLv3 write finished A
SSL_connect:SSLv3 flush data
read from 0x10b6410 [0x11b7b33] (5 bytes => 5 (0x5))
0000 - 16 03 01 03 3a ....:
read from 0x10b6410 [0x11b7b38] (826 bytes => 826 (0x33A))
0000 - 04 00 03 36 00 00 00 00-03 30 cd da 47 9b 4d 44 ...6.....0..G.MD
<SNIP>
0330 - af 38 7b e6 5d 7b 74 cd-44 46 .8{.]{t.DF
SSL_connect:SSLv3 read server session ticket A
read from 0x10b6410 [0x11b7b33] (5 bytes => 5 (0x5))
0000 - 14 03 01 00 01 .....
read from 0x10b6410 [0x11b7b38] (1 bytes => 1 (0x1))
0000 - 01 .
read from 0x10b6410 [0x11b7b33] (5 bytes => 5 (0x5))
0000 - 16 03 01 00 30 ....0
read from 0x10b6410 [0x11b7b38] (48 bytes => 48 (0x30))
0000 - c9 f8 8c 9e 31 e6 5a 7b-04 e2 17 8b ff 05 a6 35 ....1.Z{.......5
0010 - 7d 30 8e a3 80 69 8d d6-c0 41 1e 19 68 ad b6 cb }0...i...A..h...
0020 - c0 35 9e 7c e6 a3 6c 1f-9d f2 3c 07 8f 75 68 bf .5.|..l...<..uh.
SSL_connect:SSLv3 read finished A
---
Certificate chain
0 s:/OU=Domain Control Validated/OU=Gandi Standard Wildcard
SSL/CN=*.freenode.net
i:/C=FR/O=GANDI SAS/CN=Gandi Standard SSL CA
1 s:/C=FR/O=GANDI SAS/CN=Gandi Standard SSL CA
i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST
Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
---
Server certificate
-----BEGIN CERTIFICATE-----
<SNIP>
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/OU=Gandi Standard Wildcard
SSL/CN=*.freenode.net
issuer=/C=FR/O=GANDI SAS/CN=Gandi Standard SSL CA
---
No client certificate CA names sent
---
SSL handshake has read 3965 bytes and written 1519 bytes
---
...
>> $ openssl req -nodes -newkey ec:key -x509 -days 730 -out cert
>
> Here you generate another key,
privkey.pem
> and a certificate for that key in cert.
Right, these two files which I combine into foo.pem and feed to s_client.
> I wouldn't expect any program to work with that combination. GnuTLS
> should have warned about the key mismatch though.
>
> regards,
> Nikos
I see now that the combinations I used are different for s_client than
gnutls-cli; totally wrong for the latter. Thanks for pointing that out.
I am still unsure of what to do with gnutls-cli. What if I do instead
$ gnutls-cli --debug 9999 --x509cafile /etc/ssl/certs/ca-certificates.crt
--x509certfile foo.pem -p 7000 chat.freenode.net
|<2>| Intel SSSE3 was detected
|<2>| Intel AES accelerator was detected
|<2>| Intel GCM accelerator was detected
|<2>| p11: loaded provider 'p11-kit-trust'
|<2>| ASSERT: pkcs11.c:431
Processed 167 CA certificate(s).
Resolving 'chat.freenode.net'...
Connecting to '82.96.64.4:7000'...
|<4>| REC[0x13f1330]: Allocating epoch #0
<SNIP>
- Successfully sent 0 certificate(s) to server.
...
or perhaps:
$ gnutls-cli --debug 9999 --x509cafile /etc/ssl/certs/ca-certificates.crt
--x509certfile cert --x509keyfile privkey.pem -p 7000 chat.freenode.net
|<2>| Intel SSSE3 was detected
|<2>| Intel AES accelerator was detected
|<2>| Intel GCM accelerator was detected
|<2>| p11: loaded provider 'p11-kit-trust'
|<2>| ASSERT: pkcs11.c:431
Processed 167 CA certificate(s).
|<2>| ASSERT: x509_b64.c:299
|<2>| Could not find '-----BEGIN RSA PRIVATE KEY'
|<2>| ASSERT: x509_b64.c:299
|<2>| Could not find '-----BEGIN DSA PRIVATE KEY'
|<2>| ASSERT: x509_b64.c:299
|<2>| Could not find '-----BEGIN EC PRIVATE KEY'
|<2>| ASSERT: privkey.c:481
|<2>| Falling back to PKCS #8 key decoding
|<2>| ASSERT: privkey.c:282
|<2>| ASSERT: privkey_pkcs8.c:1049
|<2>| ASSERT: privkey_pkcs8.c:1192
|<2>| ASSERT: privkey_pkcs8.c:987
|<2>| ASSERT: privkey_pkcs8.c:1292
|<2>| ASSERT: privkey.c:628
|<2>| ASSERT: privkey.c:282
|<2>| ASSERT: privkey_pkcs8.c:1049
|<2>| ASSERT: privkey_pkcs8.c:1192
|<2>| ASSERT: privkey_pkcs8.c:987
|<2>| ASSERT: privkey_pkcs8.c:1292
|<2>| ASSERT: x509_b64.c:299
|<2>| Could not find '-----BEGIN PKCS12'
|<2>| ASSERT: pkcs12.c:207
|<2>| ASSERT: privkey.c:569
|<2>| ASSERT: privkey_openssl.c:150
|<2>| ASSERT: privkey.c:652
|<2>| ASSERT: gnutls_privkey.c:958
*** Error loading url: Error in parsing.
More information about the Gnutls-help
mailing list