Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b7b92258
Unverified
Kaydet (Commit)
b7b92258
authored
Şub 25, 2018
tarafından
Christian Heimes
Kaydeden (comit)
GitHub
Şub 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31809: test secp ECDH curves (#4036)
Add tests to verify connection with secp384r1 ECDH curves.
üst
186b606d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
test_ssl.py
Lib/test/test_ssl.py
+52
-0
2017-10-18-18-07-45.bpo-31809.KlQrkE.rst
...EWS.d/next/Tests/2017-10-18-18-07-45.bpo-31809.KlQrkE.rst
+1
-0
No files found.
Lib/test/test_ssl.py
Dosyayı görüntüle @
b7b92258
...
...
@@ -143,6 +143,21 @@ def have_verify_flags():
# 0.9.8 or higher
return
ssl
.
OPENSSL_VERSION_INFO
>=
(
0
,
9
,
8
,
0
,
15
)
def
_have_secp_curves
():
if
not
ssl
.
HAS_ECDH
:
return
False
ctx
=
ssl
.
SSLContext
(
ssl
.
PROTOCOL_TLS_SERVER
)
try
:
ctx
.
set_ecdh_curve
(
"secp384r1"
)
except
ValueError
:
return
False
else
:
return
True
HAVE_SECP_CURVES
=
_have_secp_curves
()
def
utc_offset
():
#NOTE: ignore issues like #1647654
# local time = utc time + utc offset
if
time
.
daylight
and
time
.
localtime
()
.
tm_isdst
>
0
:
...
...
@@ -3523,6 +3538,43 @@ class ThreadedTests(unittest.TestCase):
if
"ADH"
not
in
parts
and
"EDH"
not
in
parts
and
"DHE"
not
in
parts
:
self
.
fail
(
"Non-DH cipher: "
+
cipher
[
0
])
@unittest.skipUnless
(
HAVE_SECP_CURVES
,
"needs secp384r1 curve support"
)
def
test_ecdh_curve
(
self
):
# server secp384r1, client auto
client_context
,
server_context
,
hostname
=
testing_context
()
server_context
.
set_ecdh_curve
(
"secp384r1"
)
server_context
.
set_ciphers
(
"ECDHE:!eNULL:!aNULL"
)
server_context
.
options
|=
ssl
.
OP_NO_TLSv1
|
ssl
.
OP_NO_TLSv1_1
stats
=
server_params_test
(
client_context
,
server_context
,
chatty
=
True
,
connectionchatty
=
True
,
sni_name
=
hostname
)
# server auto, client secp384r1
client_context
,
server_context
,
hostname
=
testing_context
()
client_context
.
set_ecdh_curve
(
"secp384r1"
)
server_context
.
set_ciphers
(
"ECDHE:!eNULL:!aNULL"
)
server_context
.
options
|=
ssl
.
OP_NO_TLSv1
|
ssl
.
OP_NO_TLSv1_1
stats
=
server_params_test
(
client_context
,
server_context
,
chatty
=
True
,
connectionchatty
=
True
,
sni_name
=
hostname
)
# server / client curve mismatch
client_context
,
server_context
,
hostname
=
testing_context
()
client_context
.
set_ecdh_curve
(
"prime256v1"
)
server_context
.
set_ecdh_curve
(
"secp384r1"
)
server_context
.
set_ciphers
(
"ECDHE:!eNULL:!aNULL"
)
server_context
.
options
|=
ssl
.
OP_NO_TLSv1
|
ssl
.
OP_NO_TLSv1_1
try
:
stats
=
server_params_test
(
client_context
,
server_context
,
chatty
=
True
,
connectionchatty
=
True
,
sni_name
=
hostname
)
except
ssl
.
SSLError
:
pass
else
:
# OpenSSL 1.0.2 does not fail although it should.
if
IS_OPENSSL_1_1
:
self
.
fail
(
"mismatch curve did not fail"
)
def
test_selected_alpn_protocol
(
self
):
# selected_alpn_protocol() is None unless ALPN is used.
client_context
,
server_context
,
hostname
=
testing_context
()
...
...
Misc/NEWS.d/next/Tests/2017-10-18-18-07-45.bpo-31809.KlQrkE.rst
0 → 100644
Dosyayı görüntüle @
b7b92258
Add tests to verify connection with secp ECDH curves.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment