def self_signed(self):
        """
        :return:
            A boolean - if the certificate is self-signed
        """

        if self._self_signed is None:
            self._self_signed = False
            if self.asn1.self_signed in set(['yes', 'maybe']):

                signature_algo = self.asn1['signature_algorithm'].signature_algo
                hash_algo = self.asn1['signature_algorithm'].hash_algo

                if signature_algo == 'rsassa_pkcs1v15':
                    verify_func = rsa_pkcs1v15_verify
                elif signature_algo == 'dsa':
                    verify_func = dsa_verify
                elif signature_algo == 'ecdsa':
                    verify_func = ecdsa_verify
                else:
                    raise OSError(pretty_message(
                        '''
                        Unable to verify the signature of the certificate since
                        it uses the unsupported algorithm %s
                        ''',
                        signature_algo
                    ))

                try:
                    verify_func(
                        self,
                        self.asn1['signature_value'].native,
                        self.asn1['tbs_certificate'].dump(),
                        hash_algo
                    )
                    self._self_signed = True
                except (SignatureError):
                    pass

        return self._self_signed
def self_signed(self):
        """
        :return:
            A boolean - if the certificate is self-signed
        """

        if self._self_signed is None:
            self._self_signed = False
            if self.asn1.self_signed in set(['yes', 'maybe']):

                signature_algo = self.asn1['signature_algorithm'].signature_algo
                hash_algo = self.asn1['signature_algorithm'].hash_algo

                if signature_algo == 'rsassa_pkcs1v15':
                    verify_func = rsa_pkcs1v15_verify
                elif signature_algo == 'dsa':
                    verify_func = dsa_verify
                elif signature_algo == 'ecdsa':
                    verify_func = ecdsa_verify
                else:
                    raise OSError(pretty_message(
                        '''
                        Unable to verify the signature of the certificate since
                        it uses the unsupported algorithm %s
                        ''',
                        signature_algo
                    ))

                try:
                    verify_func(
                        self,
                        self.asn1['signature_value'].native,
                        self.asn1['tbs_certificate'].dump(),
                        hash_algo
                    )
                    self._self_signed = True
                except (SignatureError):
                    pass

        return self._self_signed
def self_signed ( self ) : if self . _self_signed is None : self . _self_signed = False if self . asn1 . self_signed in set ( [ 'yes' , 'maybe' ] ) : signature_algo = self . asn1 [ 'signature_algorithm' ] . signature_algo hash_algo = self . asn1 [ 'signature_algorithm' ] . hash_algo if signature_algo == 'rsassa_pkcs1v15' : verify_func = rsa_pkcs1v15_verify elif signature_algo == 'dsa' : verify_func = dsa_verify elif signature_algo == 'ecdsa' : verify_func = ecdsa_verify else : raise OSError ( pretty_message ( '''
                        Unable to verify the signature of the certificate since
                        it uses the unsupported algorithm %s
                        ''' , signature_algo ) ) try : verify_func ( self , self . asn1 [ 'signature_value' ] . native , self . asn1 [ 'tbs_certificate' ] . dump ( ) , hash_algo ) self . _self_signed = True except ( SignatureError ) : pass return self . _self_signed
:return:
            A boolean - if the certificate is self-signed
: return : A boolean - if the certificate is self - signed