':return:
The bit size of the public key, as an integer'

@property
def bit_size(self):

    if (self._bit_size is None):
        if (self.algorithm == u'ec'):
            self._bit_size = (((len(self[u'public_key'].native) - 1) / 2) * 8)
        else:
            if (self.algorithm == u'rsa'):
                prime = self[u'public_key'].parsed[u'modulus'].native
            elif (self.algorithm == u'dsa'):
                prime = self[u'algorithm'][u'parameters'][u'p'].native
            self._bit_size = int(math.ceil(math.log(prime, 2)))
            modulus = (self._bit_size % 8)
            if (modulus != 0):
                self._bit_size += (8 - modulus)
    return self._bit_size
