network programming and sockets getpeercert([binary_form]returns the certificate from the other end of the connectionif any if there is no certificate none is returned if there was certificate but it wasn' validatedan empty dictionary is returned if validated certificate is receiveda dictionary with the keys 'subjectand 'notafteris returned if binary_form is set truethe certificate is returned as der-encoded byte sequence read([nbytes]reads up to nbytes of data and returns it if nbytes is omittedup to , bytes are returned write(datawrites the byte string data returns the number of bytes written unwrap(shuts down the ssl connection and returns the underlying socket object on which further unencrypted communication can be carried out the following utility functions are also defined by the modulecert_time_to_seconds(timestringconverts string timestring from the format used in certificates to floating-point number as compatible with the time time(function der_cert_to_pem_cert(derbytesgiven byte string derbytes containing der-encoded certificatereturns pemencoded string version of the certificate pem_cert_to_der_cert(pemstringgiven string pemstring containing pem-encoded string version of certificatereturns der-encoded byte string version of the certificate get_server_certificate(addr [ssl_version [ca_certs]]retrieves the certificate of an ssl server and returns it as pem-encoded string addr is an address of the form (hostnameportssl_version is the ssl version numberand ca_certs is the name of file containing certificate authority certificates as described for the wrap_socket(function rand_status(returns true or false if the ssl layer thinks that the pseudorandom number generator has been seeded with enough randomness rand_egd(pathreads bytes of randomness from an entropy-gathering daemon and adds it to the pseudorandom number generator path is the name of unix-domain socket for the daemon rand_add(bytesentropyadds the bytes in byte string bytes into the pseudorandom number generator entropy is nonnegative floating-point number giving the lower bound on the entropy lib fl ff