Hi Steve, thanks for helping out!
The server cert is P-256 and the CA is P-384, please see below. Is that ok?
Fredrik
openssl x509 -noout -text -in server-secp256r1-cert.pem
Certificate:
Data:
Version: 1 (0x0)
Serial Number: 3 (0x3)
Signature Algorithm: ecdsa-with-SHA1
Issuer: C=SE, ST=Stockholm, O=Foo, CN=Bar CA
Validity
Not Before: Oct 7 06:59:47 2014 GMT
Not After : Oct 6 06:59:47 2019 GMT
Subject: C=SE, ST=Stockholm, O=Foo, CN=Bar
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
pub:
04:b1:40:a9:b9:d0:01:c7:ed:b0:79:11:54:95:85:
a4:88:3a:4a:79:a6:dc:6f:5f:34:d1:b4:e7:bb:5b:
c9:9c:ab:22:d3:99:31:51:33:4e:c7:43:4e:7e:9c:
dc:59:4c:dd:0a:70:48:e5:5e:0d:36:08:50:78:7b:
07:0f:83:ed:7a
ASN1 OID: prime256v1
Signature Algorithm: ecdsa-with-SHA1
30:66:02:31:00:81:85:94:a8:e5:f7:3a:55:07:21:ca:72:8b:
e3:80:a9:e0:aa:97:e8:0f:22:53:fb:2f:7f:1e:7e:6d:ea:d5:
70:c8:9e:ba:95:25:f4:ef:91:ec:67:35:51:69:73:53:6f:02:
31:00:91:6e:cc:b5:ac:5e:94:fe:19:1a:29:c6:ca:cd:ac:74:
8c:3b:50:8f:18:d5:ed:94:aa:44:2e:7a:17:d7:e7:ab:c9:8e:
03:da:06:2d:be:be:52:34:0c:d7:7d:07:52:77
openssl x509 -noout -text -in ca-cert.pem
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 15490594899219511094 (0xd6f9a5fcf774f736)
Signature Algorithm: ecdsa-with-SHA1
Issuer: C=SE, ST=Stockholm, O=Foo, CN=Bar CA
Validity
Not Before: Oct 7 06:55:12 2014 GMT
Not After : Oct 4 06:55:12 2024 GMT
Subject: C=SE, ST=Stockholm, O=Foo, CN=Bar CA
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (384 bit)
pub:
04:7a:36:38:33:5c:21:36:04:cb:6c:28:1a:1c:d4:
f6:72:e9:54:3e:08:ed:80:3f:cc:b1:f2:e0:07:b8:
bb:9d:77:a9:d3:08:a0:d6:fb:27:bf:d5:53:a0:eb:
24:79:10:21:34:3b:02:22:b9:6d:d2:af:8c:e1:ea:
a8:03:e5:d6:ec:f5:a7:da:64:66:fd:ab:46:cc:ae:
e6:49:ec:b2:0a:56:50:83:12:e2:97:65:b4:04:8c:
a3:a5:a1:6e:57:1e:72
ASN1 OID: secp384r1
X509v3 extensions:
X509v3 Subject Key Identifier:
7A:51:2F:7F:35:6A:A5:C7:08:7B:17:89:45:01:0F:72:B3:F5:81:24
X509v3 Authority Key Identifier:
keyid:7A:51:2F:7F:35:6A:A5:C7:08:7B:17:89:45:01:0F:72:B3:F5:81:24
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: ecdsa-with-SHA1
30:64:02:30:54:43:52:92:54:74:b6:42:d8:3e:d4:d2:41:96:
b5:86:98:07:46:67:44:21:19:09:31:d5:f2:56:c0:9f:2b:fb:
cc:cb:33:a2:e7:46:2b:c6:89:e7:49:77:9b:2c:ee:f2:02:30:
1a:33:46:5a:26:89:d4:b2:b8:66:13:a4:0e:47:09:2e:2c:3e:
ba:dc:89:02:a4:1a:0e:57:e1:de:ba:62:b7:20:84:d3:cd:4e:
22:66:94:2f:fd:88:4b:28:80:df:e6:ef
On Fri, Nov 14, 2014 at 7:35 PM, Dr. Stephen Henson <[email protected]> wrote:
> On Fri, Nov 14, 2014, Fredrik Jansson wrote:
>
>> Hi!
>>
>> Thanks!
>>
>> I am using 1.0.2b3 on both server and client, and I have the call to
>> SSL_CTX_set_ecdh_auto, but still no luck.
>>
>> The exact code is as follows:
>>
>> 358 void initialize(TLSSettings const& settings) {
>> 359 ctx_ = SSL_CTX_new(TLSv1_2_server_method());
>> 360 if (!ctx_) {
>> 361 throw std::runtime_error(OpenSSLSup::currentError());
>> 362 }
>> 363
>> 364 static const unsigned char context[] = "WVPN-TLS";
>> 365
>> 366 if (!SSL_CTX_set_session_id_context(ctx_, context,
>> sizeof(context))) {
>> 367 debug.LogE(Debug::System, "Failed to set session ID
>> context, session resume will fail");
>> 368 }
>> 369
>> 370 auto serverCert =
>> OpenSSLSup::loadPKCS12(settings.certificate(),
>> settings.certPassword());
>> 371
>> 372 debug.Log(Debug::System, "Server certificate '%s' (%s)",
>> 373 OpenSSLSup::commonName(serverCert.cert.get()).c_str(),
>> 374 settings.certificate().c_str());
>> 375
>> 376 SSL_CTX_set_info_callback(ctx_, ssl_info_cb);
>> 377
>> 378 if (!SSL_CTX_use_certificate(ctx_, serverCert.cert.get())) {
>> 379 debug.LogE(Debug::System, "Failed to set server
>> certificate: %s",
>> 380 OpenSSLSup::currentError().c_str());
>> 381 throw std::runtime_error("Failed to create context");
>> 382 }
>> 383
>> 384 if (!SSL_CTX_use_PrivateKey(ctx_, serverCert.privateKey.get())) {
>> 385 debug.LogE(Debug::System, "Failed to set server
>> private key: %s",
>> 386 OpenSSLSup::currentError().c_str());
>> 387 throw std::runtime_error("Failed to create context");
>> 388 }
>> 389
>> 390 auto vfy = SSL_VERIFY_CLIENT_ONCE | SSL_VERIFY_PEER;
>> 391 if(settings.requireClientCert()) {
>> 392 vfy |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
>> 393 }
>> 394
>> 395 SSL_CTX_set_verify(ctx_, vfy, nullptr);
>> 396 SSL_CTX_set_ecdh_auto(ctx_, 1);
>> 397
>> 398 std::string ciphers;
>> 399
>> 400 ciphers = "SUITEB128";
>> 401
>> 402 if (!ciphers.empty()) {
>> 403 if (SSL_CTX_set_cipher_list(ctx_, ciphers.c_str())) {
>> 404 debug.Log(Debug::System, "Successfully set ciphers
>> %s", ciphers.c_str());
>> 405 }
>> 406 else {
>> 407 debug.LogE(Debug::System, "Failed to set ciphers %s, %s",
>> 408 ciphers.c_str(),
>> 409 OpenSSLSup::currentError().c_str());
>> 410 throw std::runtime_error("Failed to create context");
>> 411 }
>> 412 }
>> 413
>> 414 SSL_CTX_set_options(ctx_, SSL_OP_NO_TICKET);
>> 415 SSL_CTX_set_session_cache_mode(ctx_, SSL_SESS_CACHE_BOTH);
>> 416 SSL_CTX_sess_set_remove_cb(ctx_, ssl_remove_session_cb);
>> 417 CertStore::setStoreInCTX(ctx_);
>> 418 }
>>
>>
>> Warm regards,
>> Fredrik
>>
>
> What algorithms are used by the server certificate and chain? They all have to
> be ECDSA and P-384 and P-256. Signing a certificate which carries a P-384 key
> with a P-256 key is also illegal.
>
> Steve.
> --
> Dr Stephen N. Henson. OpenSSL project core developer.
> Commercial tech support now available see: http://www.openssl.org
> ______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> User Support Mailing List [email protected]
> Automated List Manager [email protected]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]