ó FRTc@s”dZddlZddlZddlZddlZddlmZmZdejfd„ƒYZ d„Z d„Z dej fd „ƒYZ dS( sCExtensions to allow HTTPS requests with SSL certificate validation.i˙˙˙˙N(tsixt http_clienttInvalidCertificateExceptioncBs eZdZd„Zd„ZRS(s?Raised when a certificate is provided with an invalid hostname.cCs/tjj|ƒ||_||_||_dS(sĤConstructor. Args: host: The hostname the connection was made to. cert: The SSL certificate (as a dictionary) the host returned. N(Rt HTTPExceptiont__init__thosttcerttreason(tselfRRR((sB/opt/freeware/lib/python2.7/site-packages/boto/https_connection.pyR"s  cCsd|j|j|jfS(Ns0Host %s returned an invalid certificate (%s): %s(RRR(R((sB/opt/freeware/lib/python2.7/site-packages/boto/https_connection.pyt__str__.s(t__name__t __module__t__doc__RR (((sB/opt/freeware/lib/python2.7/site-packages/boto/https_connection.pyRs cCs‚d|krAg|dD]&}|djƒdkr|d^qSg|dD].}|ddjƒdkrL|dd^qLSdS(sıReturns a list of valid host globs for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. Returns: list: A list of valid host globs. tsubjectAltNameitdnsitsubjectt commonnameN(tlower(Rtx((sB/opt/freeware/lib/python2.7/site-packages/boto/https_connection.pytGetValidHostsForCert3s 5cCsxt|ƒ}tjjd||ƒxO|D]G}|jddƒjddƒ}tjd|f|tjƒr)tSq)Wt S(sValidates that a given hostname is valid for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. hostname: The hostname to test. Returns: bool: Whether or not the hostname is valid for this certificate. s@validating server certificate: hostname=%s, certificate hosts=%st.s\.t*s[^.]*s^%s$( RtbototlogtdebugtreplacetretsearchtItTruetFalse(RthostnamethostsRthost_re((sB/opt/freeware/lib/python2.7/site-packages/boto/https_connection.pytValidateCertificateHostnameBs    tCertValidatingHTTPSConnectioncBs8eZdZejZeddddd„Zd„ZRS(sDAn HTTPConnection that connects over SSL and validates certificates.cKsTtjr||ds