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
b9d7e048
Kaydet (Commit)
b9d7e048
authored
Tem 29, 2006
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[Bug #1530382] Document SSL.server(), .issuer() methods
üst
52740be4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
libsocket.tex
Doc/lib/libsocket.tex
+52
-0
No files found.
Doc/lib/libsocket.tex
Dosyayı görüntüle @
b9d7e048
...
...
@@ -711,6 +711,17 @@ If \var{n} is provided, read \var{n} bytes from the SSL connection, otherwise
read until EOF. The return value is a string of the bytes read.
\end{methoddesc}
\begin{methoddesc}
{
server
}{}
Returns a string containing the ASN.1 distinguished name identifying the
server's certificate. (See below for an example
showing what distinguished names look like.)
\end{methoddesc}
\begin{methoddesc}
{
issuer
}{}
Returns a string containing the ASN.1 distinguished name identifying the
issuer of the server's certificate.
\end{methoddesc}
\subsection
{
Example
\label
{
socket-example
}}
Here are four minimal example programs using the TCP/IP protocol:
\
a
...
...
@@ -833,3 +844,44 @@ data = s.recv(1024)
s.close()
print 'Received', repr(data)
\end{verbatim}
This example connects to an SSL server, prints the
server and issuer's distinguished names, sends some bytes,
and reads part of the response:
\begin{verbatim}
import socket
s = socket.socket(socket.AF
_
INET, socket.SOCK
_
STREAM)
s.connect(('www.verisign.com', 443))
ssl
_
sock = socket.ssl(s)
print repr(ssl
_
sock.server())
print repr(ssl
_
sock.issuer())
# Set a simple HTTP request -- use httplib in actual code.
ssl
_
sock.write("""GET / HTTP/1.0
\r
Host: www.verisign.com
\r\n\r\n
""")
# Read a chunk of data. Will not necessarily
# read all the data returned by the server.
data = ssl
_
sock.read()
# Note that you need to close the underlying socket, not the SSL object.
del ssl
_
sock
s.close()
\end{verbatim}
At this writing, this SSL example prints the following output (line
breaks inserted for readability):
\begin{verbatim}
'/C=US/ST=California/L=Mountain View/
O=VeriSign, Inc./OU=Production Services/
OU=Terms of use at www.verisign.com/rpa (c)00/
CN=www.verisign.com'
'/O=VeriSign Trust Network/OU=VeriSign, Inc./
OU=VeriSign International Server CA - Class 3/
OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign'
\end{verbatim}
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