Your IP : 216.73.216.134


Current Path : /opt/rh/rh-python35/root/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/rh/rh-python35/root/lib64/python3.5/__pycache__/ssl.cpython-35.opt-1.pyc



���\5��#@ssdZddlZddlZddlZddlZddlZddlmZddlm	Z
mZddl
Z
ddl
mZmZmZddl
mZmZddl
mZmZmZmZmZmZddl
mZmZmZdd	l
mZmZdd
l
m Z m!Z!m"Z"m#Z#yddl
m$Z$Wne%k
rPYnXdd
�Z&e&d�e&d�e&d�e&d�ddl
m'Z'm(Z(m)Z)m*Z*ddl
m+Z+ej,de-dd�de
�dd�e.j/j0�D�Z1y
e2Z3Wne4k
rdZ3YnXej5dkr<ddl
m6Z6m7Z7ddl8m8Z8m9Z9m:Z:m;Z;ddl8m<Z<m=Z=ddl>Z>ddl?Z?e@ZAe
jBr�dgZCngZCdZDd ZEGd!d"�d"eF�ZGd#d$d%�ZHd&d'�ZId(d)�ZJed*d+�ZKd,d-�ZLGd.d/�d/ed/d0��ZMGd1d2�d2eMe
�ZNGd3d4�d4e�ZOeNjPd5dd6dd7dd8d9�ZQeRd:dd;d<d=eNjPd>dd?dd5dd6dd7dd@dA�ZSeQZTeSZUGdBdC�dC�ZVGdDdE�dEe8�ZWddd<eeRddFdFddGdH�	ZXdIdJ�ZYdKZZdLZ[dMdN�Z\dOdP�Z]eRddQdR�Z^dSdT�Z_dS)Ua�
This module provides some more Pythonic support for SSL.

Object types:

  SSLSocket -- subtype of socket.socket which does SSL over the socket

Exceptions:

  SSLError -- exception raised for I/O errors

Functions:

  cert_time_to_seconds -- convert time string used for certificate
                          notBefore and notAfter functions to integer
                          seconds past the Epoch (the time values
                          returned from time.time())

  fetch_server_certificate (HOST, PORT) -- fetch the certificate provided
                          by the server running on HOST at port PORT.  No
                          validation of the certificate is performed.

Integer constants:

SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT

SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE

The following group define certificate requirements that one side is
allowing/requiring from the other side:

CERT_NONE - no certificates from the other side are required (or will
            be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
                validated, and if validation fails, the connection will
                also fail
CERT_REQUIRED - certificates are required, and will be validated, and
                if validation fails, the connection will also fail

The following constants identify various SSL protocol variants:

PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2

The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6

ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
�N)�
namedtuple)�Enum�IntEnum)�OPENSSL_VERSION_NUMBER�OPENSSL_VERSION_INFO�OPENSSL_VERSION)�_SSLContext�	MemoryBIO)�SSLError�SSLZeroReturnError�SSLWantReadError�SSLWantWriteError�SSLSyscallError�SSLEOFError)�	CERT_NONE�
CERT_OPTIONAL�
CERT_REQUIRED)�txt2obj�nid2obj)�RAND_status�RAND_add�
RAND_bytes�RAND_pseudo_bytes)�RAND_egdcCs@x9tt�D]+}|j|�r
tt|�t�|<q
WdS)N)�dir�_ssl�
startswith�getattr�globals)�prefix�n�r!�3/opt/rh/rh-python35/root/usr/lib64/python3.5/ssl.py�_import_symbolsssr#ZOP_ZALERT_DESCRIPTION_Z
SSL_ERROR_ZVERIFY_)�HAS_SNI�HAS_ECDH�HAS_NPN�HAS_ALPN)�_OPENSSL_API_VERSION�
_SSLMethodcCs
|jd�S)NZ	PROTOCOL_)r)�namer!r!r"�<lambda>�sr+�sourcecCsi|]\}}||�qSr!r!)�.0r*�valuer!r!r"�
<dictcomp>�s	r/�win32)�enum_certificates�	enum_crls)�socket�AF_INET�SOCK_STREAM�create_connection)�
SOL_SOCKET�SO_TYPEz
tls-uniquez�ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:!eNULL:!MD5z�ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:!eNULL:!MD5:!DSS:!RC4c@seZdZdS)�CertificateErrorN)�__name__�
__module__�__qualname__r!r!r!r"r9�sr9�c	CsAg}|sdS|jd�^}}|jd�}||krVtdt|���|sr|j�|j�kS|dkr�|jd�nY|jd�s�|jd�r�|jtj|��n"|jtj|�j	dd��x$|D]}|jtj|��q�Wtj
d	d
j|�dtj�}|j
|�S)zhMatching according to RFC 6125, section 6.4.3

    http://tools.ietf.org/html/rfc6125#section-6.4.3
    F�.�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr9�repr�lower�appendr�re�escape�replace�compile�join�
IGNORECASE�match)	Zdn�hostnameZ
max_wildcardsZpatsZleftmostZ	remainderZ	wildcardsZfragZpatr!r!r"�_dnsname_match�s&"
&rMcCstj|j��}||kS)z�Exact matching of IP addresses.

    RFC 6125 explicitly doesn't define an algorithm for this
    (section 1.7.2 - "Out of Scope").
    )�	ipaddress�
ip_address�rstrip)Zipname�host_ipZipr!r!r"�_ipaddress_match�srRcCs�|std��ytj|�}Wntk
r?d}YnXg}|jdf�}x�|D]\}}|dkr�|dkr�t||�r�dS|j|�q_|dkr_|dk	r�t||�r�dS|j|�q_W|sHx]|jdf�D]I}x@|D]8\}}|dkrt||�r3dS|j|�qWq�Wt|�dkr�td	|d
j	t
t|��f��n;t|�dkr�td||df��ntd
��dS)a)Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed, but IP addresses are not accepted for *hostname*.

    CertificateError is raised on failure. On success, the function
    returns nothing.
    ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNZsubjectAltNameZDNSz
IP AddressZsubjectZ
commonNamer=z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)�
ValueErrorrNrO�getrMrDrR�lenr9rI�maprB)�certrLrQZdnsnamesZsan�keyr.�subr!r!r"�match_hostname�s>
%rZ�DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCs�tj�}tjj|d|d�}tjj|d|d�}ttjj|�ra|ndtjj|�r||nd|�S)z/Return paths to default cafile and capath.
    rr=��N)	r�get_default_verify_paths�os�environrTr[�path�isfile�isdir)�parts�cafile�capathr!r!r"r^6sr^cs^eZdZdZfZ�fdd�Ze�fdd��Ze�fdd��Z�S)�_ASN1Objectz#ASN.1 object identifier lookup
    cst�j|t|dd��S)Nr*F)�super�__new__�_txt2obj)�cls�oid)�	__class__r!r"riIsz_ASN1Object.__new__cst�j|t|��S)z3Create _ASN1Object from OpenSSL numeric ID
        )rhri�_nid2obj)rkZnid)rmr!r"�fromnidLsz_ASN1Object.fromnidcst�j|t|dd��S)z=Create _ASN1Object from short name, long name or OID
        r*T)rhrirj)rkr*)rmr!r"�fromnameRsz_ASN1Object.fromname)	r:r;r<�__doc__�	__slots__ri�classmethodrorpr!r!)rmr"rgDs
rgznid shortname longname oidc@s"eZdZdZdZdZdS)�PurposezDSSLContext purpose flags with X509v3 Extended Key Usage objects
    z1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r:r;r<rq�SERVER_AUTH�CLIENT_AUTHr!r!r!r"rtYsrtc@s�eZdZdZdZdZdd�Zdd	�Zd
dddd
d�Zd
ddd�Z	dd�Z
dd�Zdd�Ze
jdd�ZdS)�
SSLContextz|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.�protocol�__weakref__�CA�ROOTcOs/tj||�}|tkr+|jt�|S)N)rri�_SSLv2_IF_EXISTS�set_ciphers�_DEFAULT_CIPHERS)rkrx�args�kwargs�selfr!r!r"rigs
zSSLContext.__new__cCs
||_dS)N)rx)r�rxr!r!r"�__init__mszSSLContext.__init__FTNc
Cs+td|d|d|d|d|d|�S)N�sock�server_side�do_handshake_on_connect�suppress_ragged_eofs�server_hostname�_context)�	SSLSocket)r�r�r�r�r�r�r!r!r"�wrap_socketps
zSSLContext.wrap_socketcCs(|j||d|d|�}t|�S)Nr�r�)Z	_wrap_bio�	SSLObject)r�ZincomingZoutgoingr�r��sslobjr!r!r"�wrap_biozs	zSSLContext.wrap_biocCs�t�}xm|D]e}t|d�}t|�dksIt|�dkrUtd��|jt|��|j|�qW|j|�dS)N�asciir�z(NPN protocols must be 1 to 255 in length)�	bytearray�bytesrUr
rD�extendZ_set_npn_protocols)r��
npn_protocols�protosrx�br!r!r"�set_npn_protocols�s	
$zSSLContext.set_npn_protocolscCs�t�}xm|D]e}t|d�}t|�dksIt|�dkrUtd��|jt|��|j|�qW|j|�dS)Nr�rr�z)ALPN protocols must be 1 to 255 in length)r�r�rUr
rDr�Z_set_alpn_protocols)r�Zalpn_protocolsr�rxr�r!r!r"�set_alpn_protocols�s	
$zSSLContext.set_alpn_protocolscCsqt�}xQt|�D]C\}}}|dkr|dksL|j|kr|j|�qW|jd|�|S)NZx509_asnT�cadata)r�r1rlr��load_verify_locations)r��	storename�purposeZcertsrW�encodingZtrustr!r!r"�_load_windows_store_certs�s	z$SSLContext._load_windows_store_certscCs\t|t�st|��tjdkrNx!|jD]}|j||�q4W|j�dS)Nr0)�
isinstancerg�	TypeError�sys�platform�_windows_cert_storesr�Zset_default_verify_paths)r�r�r�r!r!r"�load_default_certs�szSSLContext.load_default_certs)zprotocolz__weakref__)rzr{)r:r;r<rqrrr�rir�r�r�r�r�r�rtrur�r!r!r!r"rw`s
rwrerfr�cCs9t|t�st|��tt�}|jtO_|jtO_|jtt	dd�O_|t
jkr�t|_
d|_nm|t
jkr�|jtt	dd�O_|jtt	dd�O_|jtt	dd�O_|jt�|s|s|r|j|||�n|j
tkr5|j|�|S)z�Create a SSLContext object with default settings.

    NOTE: The protocol and settings may change anytime without prior
          deprecation. The values represent a fair balance between maximum
          compatibility and security.
    ZOP_NO_COMPRESSIONrTZOP_CIPHER_SERVER_PREFERENCEZOP_SINGLE_DH_USEZOP_SINGLE_ECDH_USE)r�rgr�rw�PROTOCOL_SSLv23�options�OP_NO_SSLv2�OP_NO_SSLv3rrrtrur�verify_mode�check_hostnamervr}�_RESTRICTED_SERVER_CIPHERSr�rr�)r�rerfr��contextr!r!r"�create_default_context�s&	

r��	cert_reqsr�Fr��certfile�keyfilec
Cs�t|t�st|��t|�}	|	jtO_|	jtO_|dk	rZ||	_||	_|r||r|t	d��|s�|r�|	j
||�|s�|s�|r�|	j|||�n|	jtkr�|	j
|�|	S)a/Create a SSLContext object for Python stdlib modules

    All Python stdlib modules shall use this function to create SSLContext
    objects in order to keep common settings in one place. The configuration
    is less restrict than create_default_context()'s to increase backward
    compatibility.
    Nzcertfile must be specified)r�rgr�rwr�r�r�r�r�rS�load_cert_chainr�rr�)
rxr�r�r�r�r�rerfr�r�r!r!r"�_create_unverified_context�s"		

r�c@seZdZdZddd�Zedd��Zejdd��Zedd	��Zed
d��Z	ddd
d�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%d&�Zd'd(�ZdS))r�aThis class implements an interface on top of a low-level SSL object as
    implemented by OpenSSL. This object captures the state of an SSL connection
    but does not provide any network IO itself. IO needs to be performed
    through separate "BIO" objects which are OpenSSL's IO abstraction layer.

    This class does not have a public constructor. Instances are returned by
    ``SSLContext.wrap_bio``. This class is typically used by framework authors
    that want to implement asynchronous IO for SSL through memory buffers.

    When compared to ``SSLSocket``, this object lacks the following features:

     * Any form of network IO incluging methods such as ``recv`` and ``send``.
     * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
    NcCs||_|p||j_dS)N)�_sslobj�owner)r�r�r�r!r!r"r�s	zSSLObject.__init__cCs
|jjS)z(The SSLContext that is currently in use.)r�r�)r�r!r!r"r�szSSLObject.contextcCs||j_dS)N)r�r�)r��ctxr!r!r"r�$scCs
|jjS)z%Whether this is a server-side socket.)r�r�)r�r!r!r"r�(szSSLObject.server_sidecCs
|jjS)z]The currently set server hostname (for SNI), or ``None`` if no
        server hostame is set.)r�r�)r�r!r!r"r�-szSSLObject.server_hostnamercCs@|dk	r$|jj||�}n|jj|p6d�}|S)z�Read up to 'len' bytes from the SSL object and return them.

        If 'buffer' is provided, read into this buffer and return the number of
        bytes read.
        Ni)r��read)r�rU�buffer�vr!r!r"r�3szSSLObject.readcCs|jj|�S)z�Write 'data' to the SSL object and return the number of bytes
        written.

        The 'data' argument must support the buffer interface.
        )r��write)r��datar!r!r"r�?szSSLObject.writeFcCs|jj|�S)z�Returns a formatted version of the data in the certificate provided
        by the other end of the SSL channel.

        Return None if no certificate was provided, {} if a certificate was
        provided, but not validated.
        )r�Zpeer_certificate)r��binary_formr!r!r"�getpeercertGszSSLObject.getpeercertcCstjr|jj�SdS)z�Return the currently selected NPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if NPN is not supported by one
        of the peers.N)rr&r��selected_npn_protocol)r�r!r!r"r�Ps	zSSLObject.selected_npn_protocolcCstjr|jj�SdS)z�Return the currently selected ALPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if ALPN is not supported by one
        of the peers.N)rr'r��selected_alpn_protocol)r�r!r!r"r�Ws	z SSLObject.selected_alpn_protocolcCs
|jj�S)z_Return the currently selected cipher as a 3-tuple ``(name,
        ssl_version, secret_bits)``.)r��cipher)r�r!r!r"r�^szSSLObject.ciphercCs
|jj�S)z�Return a list of ciphers shared by the client during the handshake or
        None if this is not a valid server connection.
        )r��shared_ciphers)r�r!r!r"r�cszSSLObject.shared_cipherscCs
|jj�S)z�Return the current compression algorithm in use, or ``None`` if
        compression was not negotiated or not supported by one of the peers.)r��compression)r�r!r!r"r�iszSSLObject.compressioncCs
|jj�S)z8Return the number of bytes that can be read immediately.)r��pending)r�r!r!r"r�nszSSLObject.pendingcCsH|jj�|jjrD|js.td��t|j�|j�dS)zStart the SSL/TLS handshake.z-check_hostname needs server_hostname argumentN)r��do_handshaker�r�r�rSrZr�)r�r!r!r"r�rs

	zSSLObject.do_handshakecCs
|jj�S)z!Start the SSL shutdown handshake.)r��shutdown)r�r!r!r"�unwrap{szSSLObject.unwrapz
tls-uniquecCsF|tkrtd��|dkr9tdj|���|jj�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).z Unsupported channel binding typez
tls-uniquez({0} channel binding type not implemented)�CHANNEL_BINDING_TYPESrS�NotImplementedError�formatr�Z
tls_unique_cb)r��cb_typer!r!r"�get_channel_bindingszSSLObject.get_channel_bindingcCs
|jj�S)zZReturn a string identifying the protocol version used by the
        current SSL channel. )r��version)r�r!r!r"r��szSSLObject.version)r:r;r<rqr��propertyr��setterr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r!r!r"r�
s&		r�csGeZdZdZddddeeddeeddddddddd�Ze	dd	��Z
e
jd
d	��Z
dd�Zdd
d�Z
dd�Zdddd�Zdd�Zddd�Zdd�Zdd�Zdd�Zdd�Zdd �Zdd!d"�Zdd#d$�Zd%d&�Zdd'd(�Zdd�fd)d*�Zd+dd,d-�Zddd.d/�Zd+dd0d1�Zddd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$d>d?�Z%dd@dA�Z&dBdC�Z'dDdE�Z(dFdG�Z)dHdI�Z*dJdKdL�Z+dMdN�Z,�S)Or�z�This class implements a subtype of socket.socket that wraps
    the underlying OS socket in an SSL context when necessary, and
    provides read and write methods over that channel.NFTrcCs,|r||_n�|r+|r+td��|rD|rDtd��|rW|rW|}t|�|_||j_|r�|jj|�|r�|jj||�|r�|jj|�|r�|jj|�||_||_	||_
||_||_||_
|jtt�tkr'td��|r?|r?td��|jjr^|r^td��||_||_||_|
|_|dk	r�tj|d|jd|jd|jd	|j��|j|j��|j �nA|dk	rtj|d	|�ntj|d|	d|
d|�y|j!�Wn@t"k
rs}z |j#t#j$kr[�d
}WYdd}~XnXd}d
|_%d|_&||_'|r(ye|jj(|||�}t)|d|�|_&|r�|j�}|d
kr�td��|j*�Wn%t"tfk
r'|j+��YnXdS)Nz5certfile must be specified for server-side operationszcertfile must be specifiedz!only stream sockets are supportedz4server_hostname can only be specified in client modez'check_hostname requires server_hostname�family�type�proto�filenoFTr�gzHdo_handshake_on_connect should not be specified for non-blocking sockets),r�rSrwr�r�r�r�r}r�r�r��ssl_version�ca_certs�ciphersZ
getsockoptr7r8r5r�r�r�r�r�r�r3r�r�r�r�r��
settimeout�
gettimeout�detach�getpeername�OSError�errnoZENOTCONNZ_closedr��
_connected�_wrap_socketr�r��close)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��eZ	connectedr��timeoutr!r!r"r��s�	


													

				
zSSLSocket.__init__cCs|jS)N)r�)r�r!r!r"r��szSSLSocket.contextcCs||_||j_dS)N)r�r�r�)r�r�r!r!r"r��s	cCstd|jj��dS)NzCan't dup() %s instances)�NotImplementedrmr:)r�r!r!r"�dup�sz
SSLSocket.dupcCsdS)Nr!)r��msgr!r!r"�_checkClosed�szSSLSocket._checkClosedcCs|js|j�dS)N)r�r�)r�r!r!r"�_check_connecteds	zSSLSocket._check_connectedcCs�|j�|jstd��y|jj||�SWn[tk
r�}z;|jdtkr~|jr~|dk	rwdSdSn�WYdd}~XnXdS)zORead up to LEN bytes and return them.
        Return zero-length string on EOF.z'Read on closed or unwrapped SSL socket.rN�)r�r�rSr�r
rZ
SSL_ERROR_EOFr�)r�rUr��xr!r!r"r�
s
	zSSLSocket.readcCs/|j�|jstd��|jj|�S)zhWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.z(Write on closed or unwrapped SSL socket.)r�r�rSr�)r�r�r!r!r"r�s
	zSSLSocket.writecCs$|j�|j�|jj|�S)z�Returns a formatted version of the data in the
        certificate provided by the other end of the SSL channel.
        Return None if no certificate was provided, {} if a
        certificate was provided, but not validated.)r�r�r�r�)r�r�r!r!r"r�%s

zSSLSocket.getpeercertcCs3|j�|jstjr"dS|jj�SdS)N)r�r�rr&r�)r�r!r!r"r�/s
zSSLSocket.selected_npn_protocolcCs3|j�|jstjr"dS|jj�SdS)N)r�r�rr'r�)r�r!r!r"r�6s
z SSLSocket.selected_alpn_protocolcCs(|j�|jsdS|jj�SdS)N)r�r�r�)r�r!r!r"r�=s
	zSSLSocket.ciphercCs$|j�|jsdS|jj�S)N)r�r�r�)r�r!r!r"r�Ds
	zSSLSocket.shared_cipherscCs(|j�|jsdS|jj�SdS)N)r�r�r�)r�r!r!r"r�Js
	zSSLSocket.compressioncCsY|j�|jrB|dkr2td|j��|jj|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to send() on %s)r�r�rSrmr�r3�send)r�r��flagsr!r!r"r�Qs
	
zSSLSocket.sendcCsb|j�|jr)td|j��n5|dkrHtj|||�Stj||||�SdS)Nz%sendto not allowed on instances of %s)r�r�rSrmr3�sendto)r�r�Z
flags_or_addr�addrr!r!r"r�\s
	zSSLSocket.sendtocOstd|j��dS)Nz&sendmsg not allowed on instances of %s)r�rm)r�rr�r!r!r"�sendmsgfszSSLSocket.sendmsgcCs�|j�|jr~|dkr2td|j��t|�}d}x3||kry|j||d��}||7}qGW|Stj|||�SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s)r�r�rSrmrUr�r3�sendall)r�r�r�ZamountrAr�r!r!r"r�ls
	
zSSLSocket.sendallcs<|jdkr%t�j|||�S|j|||�SdS)z�Send a file, possibly by using os.sendfile() if this is a
        clear-text socket.  Return the total number of bytes sent.
        N)r�rh�sendfileZ_sendfile_use_send)r��file�offsetrA)rmr!r"r�|szSSLSocket.sendfileicCsV|j�|jr?|dkr2td|j��|j|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)r�r�rSrmr�r3�recv)r��buflenr�r!r!r"r��s
	

zSSLSocket.recvcCs�|j�|r+|dkr+t|�}n|dkr=d}|jru|dkretd|j��|j||�Stj||||�SdS)Nirz8non-zero flags not allowed in calls to recv_into() on %s)r�rUr�rSrmr�r3�	recv_into)r�r��nbytesr�r!r!r"r��s
	
zSSLSocket.recv_intocCs@|j�|jr)td|j��ntj|||�SdS)Nz'recvfrom not allowed on instances of %s)r�r�rSrmr3�recvfrom)r�r�r�r!r!r"r��s

	zSSLSocket.recvfromcCsC|j�|jr)td|j��ntj||||�SdS)Nz,recvfrom_into not allowed on instances of %s)r�r�rSrmr3�
recvfrom_into)r�r�r�r�r!r!r"r��s

	zSSLSocket.recvfrom_intocOstd|j��dS)Nz&recvmsg not allowed on instances of %s)r�rm)r�rr�r!r!r"�recvmsg�szSSLSocket.recvmsgcOstd|j��dS)Nz+recvmsg_into not allowed on instances of %s)r�rm)r�rr�r!r!r"�recvmsg_into�szSSLSocket.recvmsg_intocCs(|j�|jr |jj�SdSdS)Nr)r�r�r�)r�r!r!r"r��s
	
zSSLSocket.pendingcCs'|j�d|_tj||�dS)N)r�r�r3r�)r�Zhowr!r!r"r��s
	zSSLSocket.shutdowncCs?|jr%|jj�}d|_|Stdt|���dS)NzNo SSL wrapper around )r�r�rS�str)r��sr!r!r"r��s
		zSSLSocket.unwrapcCsd|_tj|�dS)N)r�r3�_real_close)r�r!r!r"r��s	zSSLSocket._real_closecCs[|j�|j�}z0|dkr8|r8|jd�|jj�Wd|j|�XdS)zPerform a TLS/SSL handshake.gN)r�r�r�r�r�)r��blockr�r!r!r"r��s

zSSLSocket.do_handshakecCs�|jrtd��|jr*td��|jj|d|j�}t|d|�|_y[|rxtj	||�}nd}tj
||�|s�d|_|jr�|j�|SWn$t
tfk
r�d|_�YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!Fr�T)r�rSr�r�r�r�r�r�r3�
connect_ex�connectr�r�r�)r�r�r�r��rcr!r!r"�
_real_connect�s&				
	zSSLSocket._real_connectcCs|j|d�dS)zQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.FN)r�)r�r�r!r!r"r��szSSLSocket.connectcCs|j|d�S)zQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.T)r�)r�r�r!r!r"r��szSSLSocket.connect_excCsItj|�\}}|jj|d|jd|jdd�}||fS)z�Accepts a new connection from a remote client, and returns
        a tuple containing that new connection wrapped with a server-side
        SSL channel, and the address of the remote client.r�r�r�T)r3�acceptr�r�r�r�)r�Znewsockr�r!r!r"r��s			zSSLSocket.acceptz
tls-uniquecCs#|jdkrdS|jj|�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).
        N)r�r�)r�r�r!r!r"r�	szSSLSocket.get_channel_bindingcCs |jdkrdS|jj�S)z�
        Return a string identifying the protocol version used by the
        current SSL channel, or None if there is no established channel.
        N)r�r�)r�r!r!r"r�szSSLSocket.version)-r:r;r<rqrr�r4r5r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r!)rmr"r��sX		T	


	r�Tc

CsCtd|d|d|d|d|d|d|d|d	|d
|	�
S)Nr�r�r�r�r�r�r�r�r�r�)r�)
r�r�r�r�r�r�r�r�r�r�r!r!r"r�sr�c
Cs�ddlm}ddlm}d}d}y'|j|dd�j��d}Wn(tk
r}td||f��Yn<X||dd�|�}||d|f|dd��SdS)a�Return the time in seconds since the Epoch, given the timestring
    representing the "notBefore" or "notAfter" date from a certificate
    in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).

    "notBefore" or "notAfter" dates must use UTC (RFC 5280).

    Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    UTC should be specified as GMT (see ASN1_TIME_print())
    r)�strptime)�timegm�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decz %d %H:%M:%S %Y GMTNr]r=z*time data %r does not match format "%%b%s"r\�)rrrrrrrr	r
rrr
)ZtimerZcalendarr�index�titlerS)Z	cert_timerrZmonthsZtime_formatZmonth_numberZttr!r!r"�cert_time_to_seconds,s
'
rz-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cCs?ttj|�dd�}tdtj|d�dtdS)z[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.�ASCII�strict�
�@)r��base64Zstandard_b64encode�
PEM_HEADER�textwrapZfill�
PEM_FOOTER)Zder_cert_bytes�fr!r!r"�DER_cert_to_PEM_certMsrcCs�|jt�stdt��|j�jt�sDtdt��|j�tt�tt��}tj|j	dd��S)zhTakes a certificate in ASCII PEM format and returns the
    DER-encoded version of it as a byte sequencez(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %srr)
rrrS�strip�endswithrrUrZdecodebytes�encode)Zpem_cert_string�dr!r!r"�PEM_cert_to_DER_certVs

#r c
Cs�|\}}|dk	r!t}nt}t|d|d|�}t|��/}|j|��}|jd�}	WdQRXWdQRXt|	�S)z�Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.Nr�reT)rr�_create_stdlib_contextr6r�r�r)
r�r�r��hostZportr�r�r�ZsslsockZdercertr!r!r"�get_server_certificatecs			r#cCstj|d�S)Nz	<unknown>)�_PROTOCOL_NAMESrT)Z
protocol_coder!r!r"�get_protocol_namevsr%)`rqrNrrEr�r_�collectionsrZenumrZ_EnumrZ_IntEnumrrrrrr	r
rrr
rrrrrrrjrrnrrrrr�ImportErrorr#r$r%r&r'r(�_convertr:r)Z__members__�itemsr$ZPROTOCOL_SSLv2r|�	NameErrorr�r1r2r3r4r5r6r7r8rr�r�Zsocket_errorZHAS_TLS_UNIQUEr�r~r�rSr9rMrRrZr[r^rgrtrwrur�r�r�Z_create_default_https_contextr!r�r�r�rrrrr r#r%r!r!r!r"�<module>Xs�."




"

"	14	I/'���	


Rosenblum TV: Video training, virtual workshops, classes, tutorials
logologologologo
  • About
  • What We Do
  • Our Clients
  • Case Studies
    • The BBC
    • CBS News
    • New York Times Television
    • Spectrum News
    • The Newark Star-Ledger
    • The United Nations
    • McGraw/Hill
    • Oyster Yachts
    • Scottish Environmental Protection Agency
  • The Power of Storytelling
  • Why iPhones?
  • Michael on Media
  • Books
  • Contact
  • About
  • What We Do
  • Our Clients
  • Case Studies
    • The BBC
    • CBS News
    • New York Times Television
    • Spectrum News
    • The Newark Star-Ledger
    • The United Nations
    • McGraw/Hill
    • Oyster Yachts
    • Scottish Environmental Protection Agency
  • The Power of Storytelling
  • Why iPhones?
  • Michael on Media
  • Books
  • Contact

RE-INVENTING THE TELEVISION NEWS BUSINESS*

A revolution in video storytelling

Creating entirely new & cost-effective production methods

From the world leaders in video production training and the creators of Character Driven Storytelling™

*and every other business that uses video

WHAT WE DO

Over the past 35 years, we have designed, built or restructured some of the most powerful news and journalism companies in the world.

We replace the traditional TV news ‘crew’ with one highly trained journalist, working alone with nothing but an iPhone.

No more TV news ‘crews’, no editors and no field producers.

This is television news done the way newspaper journalism is done – one reporter with their electronic pad and pencil.

In doing this, we can cut the cost of production by as much as 75% while increasing ratings and audience engagement.

In the place of conventional TV news ‘packages’ – ie, reporter stand up, interview, b-roll, man on the street, we marry great journalism with Netflix and Hollywood storytelling.

It’s a combination that works.

We have taken most of our clients to #1 in their respective markets.

And it’s not just for news. Any company, any profit, any NGO and anyone else who is online needs to tell their story in compelling yet cost-effective video. We can teach you to do that. Either in person or virtually.

EXAMPLES OF WHAT WE CAN TEACH YOUR STAFF TO PRODUCE

ITAY HOD

Itay Hod, MMJ with KPIX/CBS in San Francisco, took the 5-Day Intensive Video Storytelling Bootcamp in 2018.

Because he works alone, with only an iPhone, he was able to embed himself with a homeless family.

Here’s the story he produced in a one-day turn.

KIET DO

Kiet Do, an MMJ with KPIX/CBS in San Francisco, took the 5-Day Intensive Video Storytelling Bootcamp in 2021.

Here is a story he produced, all on his own, with only an iPhone and in a one-day turn.

TAYLOR SCHAUB

Taylor Schaub, an MMJ with Spectrum News 1 in LA, took the 5-Day Intensive Video Storytelling Bootcamp in 2023.

Here is a story he turned in only one day, using only an iPhone. It was the first video story he ever did and it was nominated for an Emmy.

THE BOOTCAMP

How do we convert stations and whole networks to working in this way?

Since 1988, we have run intensive 5-Day Video Storytelling Bootcamps

We have done these all over the world.

These are hands-on bootcamps, and participants learn an entirely new way of creating TV news stories.

-We shoot at a 3:1 ratio or lower, so turnaround times are fast.

-We go directly from camera to timelilne and edit – no written scripts.  We work in the medium of pictures and sound.

-We are entirely character-driven.

-We are driven by pictures and real events.

-We are focused almost entirely on ’the viewer experience’.

Since 1988, more than 70,000 journalists around the world have taken our bootcamps, either in person on virtualy.

Case Studies

CBS Case Study Logos
CBS News

We have started to work with CBS News, bringing our ideas of character-driven storytelling to one of the most successful and biggest networks in the United States. Since beginning to work with them ratings have climbed and more importantly, audience engagement is through the ceiling.

Learn More
NYT Case Study Logos
New York Times Television

We started New York Times Television in 1990 and it was the first paper to be brought into the world of TV. It quickly became one of the most successful non-fiction production companies in the United States. The series and documentaries we produced won many awards including multiple Emmys.

Learn More
BBC Case Study Logos
The BBC

We have been working with the BBC since the year 2000 helping to convert their national news network to our visual storytelling technique. Most recently we have trained teams from their sports, documentaries, and comedy divisions to make character-driven stories using only smartphones.

Learn More
Spectrum Case Study Logos
Spectrum News

For the past five years we have worked with Spectrum News to introduce and train their journalists on visual, character driven storytelling using smartphones helping to create a different kind of local news for their network of 24-Hour News Stations across the United States.

Learn More
UN Case Study Logos
The United Nations

In 2006, we were approached by the United Nations. Rather than rely on news outlets, it would be much easier to train the field operatives to produce their own stories. We spent two years working with the UN, training more than 100 of their staff in bootcamps in Geneva and Nairobi.

Learn More
Star Ledger Case Study Logos
The Newark Star-Ledger

We trained 50 print reporters at the paper to shoot and tell their own stories, in conjunction with their print work. We built a TV newsroom in their existing print newsroom – you could not ask for a better set and they began to live stream their stories in conjunction with their print work.

Learn More
Mcgraw Hill Case Study Logos
Mcgraw Hill

We spent two years with McGraw Hill, training more than 150 of their staffers, making them completely video literate. McGraw/Hill media properties we transit included Business Week, Aviation Week, (what was the name of the architecture magazine), and JD Power and Associates.

Learn More
VOA Case Study Logos
Voice of America

In 1990, we were approached by The Voice of America, the official broadcasting agency for the United States Government. When we met with VOA, they were only a short wave radio broadcaster, but working with them, we took them into television, launching VOA-TV.

Learn More
Oyster Case Study Logos
Oyster Yachts

British based Oyster Yachts makes some of the finest yachts in the world. Like every other company, they had to find a way to feed the never-ending video demands of social media – sites like Instagram and TikTok. We trained the Oyster staff to tell their own stories, using only iPhones.

Learn More
SEPA Case Study Logos
Scottish Environmental Protection Agency

We were approached by SEPA, the Scottish Environmental Protection Agency because they had to continually find a way to ‘feed the media beast’. The result was that SEPA was able to tell their own stories, whenever they wanted, and at almost no additional cost.

Learn More
Image 11-11-22 at 6.25 PM

Michael on Media

Michael Rosenblum has been writing about the media since 1988. His work and ideas have appeared in The Guardian, The Huffington Post, Ilkeston Life and many other publications.

He has been blogging regularly for the past 35 years on this subject. Having taught media studies at Columbia University, NYU and now the University of Oxford, he is considered an expert on this subject.

Continue reading this post or look back at previous posts.

Read More

Do You Have Questions About Learning Video Skills?

If you would like to know more about our courses contact us and one of our training advisors will be happy to call you.

Contact Us

Copyright 2024. All rights reserved.