Returns the raw verification key.

        :rtype: bytes
776308
def key_bytes(self):
        
        return self.key.public_bytes(
            encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo
        )
1156263
def get_public_key(self):
        """"""
        return PublicKey.from_verifying_key(
            self._private_key.get_verifying_key(),
            network=self.network, compressed=self.compressed)
179721
def raw(self) -> str:
        
        return """Version: {version}
Type: Identity
Currency: {currency}
Issuer: {pubkey}
UniqueID: {uid}
Timestamp: {timestamp}
""".format(version=self.version,
           currency=self.currency,
           pubkey=self.pubkey,
           uid=self.uid,
           timestamp=self.timestamp)
1065953
def checkKey(self, credentials):
        
        filename = self._keyfile
        if not os.path.exists(filename):
            return 0
        lines = open(filename).xreadlines()
        for l in lines:
            l2 = l.split()
            if len(l2) < 2:
                continue
            try:
                if base64.decodestring(l2[1]) == credentials.blob:
                    return 1
            except binascii.Error:
                continue
        return 0
291410
def Verify(self, public_key):
    
    # TODO(amoser): We have to do this manually for now since cryptography does
    # not yet support cert verification. There is PR 2460:
    # https://github.com/pyca/cryptography/pull/2460/files
    # that will add it, once it's in we should switch to using this.

    # Note that all times here are in UTC.
    now = rdfvalue.RDFDatetime.Now().AsDatetime()
    if now > self._value.not_valid_after:
      raise VerificationError("Certificate expired!")
    if now < self._value.not_valid_before:
      raise VerificationError("Certificate not yet valid!")

    public_key.Verify(
        self._value.tbs_certificate_bytes,
        self._value.signature,
        hash_algorithm=self._value.signature_hash_algorithm)
    return True
749656
def _get_encryption_key():
    ''''''
    # initialize ENCRYPTION_KEY the first time it is needed, so that
    # applications that use eulcore without using this specific
    # functionality do not get bogus warnings about SECRET_KEY size.
    global ENCRYPTION_KEY
    if ENCRYPTION_KEY is None:
        # NOTE: Blowfish key length is variable but must be 32-448 bits
        # (but PyCrypto does not actually make this information accessible)
        KEY_MIN_CHARS = 32/8
        KEY_MAX_CHARS = 448/8
        if KEY_MIN_CHARS <= len(settings.SECRET_KEY) <= KEY_MAX_CHARS:
            ENCRYPTION_KEY = settings.SECRET_KEY
        else:
            ENCRYPTION_KEY = hashlib.sha224(settings.SECRET_KEY).hexdigest()
            message = '''Django secret key (current length of %d) requires hashing for use as encryption key
            (to avoid hashing, should be %d-%d characters)''' % \
            (len(settings.SECRET_KEY), KEY_MIN_CHARS, KEY_MAX_CHARS)
            logger.warn(message)
    return ENCRYPTION_KEY
614357
def _verify_sig(self, m, cert):
        
        if self.sig_val:
            if self.sig_alg:
                h, sig = _tls_hash_sig[self.sig_alg].split('+')
                if sig.endswith('pss'):
                    t = "pss"
                else:
                    t = "pkcs"
                return cert.verify(m, self.sig_val, t=t, h=h)
            else:
                if self.tls_session.tls_version >= 0x0300:
                    return cert.verify(m, self.sig_val, t='pkcs', h='md5-sha1')
                else:
                    return cert.verify(m, self.sig_val, t='pkcs', h='md5')
        return False
1052597
def get_csig(self):
        
        try:
            return self.ninfo.csig
        except AttributeError:
            pass

        contents = self.get_contents()
        csig = SCons.Util.MD5signature(contents)
        self.get_ninfo().csig = csig
        return csig
1279080
def signed_raw(self) -> str:
        
        if not isinstance(self.identity, Identity):
            raise MalformedDocumentError("Can not return full revocation document created from inline")

        raw = self.raw()
        signed = "\n".join(self.signatures)
        signed_raw = raw + signed + "\n"
        return signed_raw
246348
def _get_passwordkey(self):
        """"""

        sha = SHA256.new()
        sha.update(self.password.encode('utf-8'))
        return sha.digest()
876665
def secret_key_bytes(self):
        ''' 

        '''
        if not hasattr(self, '_secret_key_bytes'):
            key = self.secret_key()
            if key is None:
                self._secret_key_bytes = None
            else:
                self._secret_key_bytes = codecs.encode(key, "utf-8")
        return self._secret_key_bytes
39075
def verify_authentication_data(self, key):
        '''
        
        '''
        correct_authentication_data = self.calculate_authentication_data(key)
        return self.authentication_data == correct_authentication_data
159521
def account_xdr_object(self):
        
        return Xdr.types.PublicKey(Xdr.const.KEY_TYPE_ED25519,
                                   self.verifying_key.to_bytes())
86946
def verify(self, signature):
        
        try:
            payload = self._payload()
            sigin = b'.'.join([self.protected.encode('utf-8'), payload])
            self.engine.verify(self.key, sigin, signature)
        except Exception as e:  # pylint: disable=broad-except
            raise InvalidJWSSignature('Verification failed', repr(e))
        return True
502512
def get_upload_key(self):
        

        if not hasattr(self, '_upload_key'):
            self._upload_key = self.get_storage().bucket.get_key(
                self.cleaned_data['key_name'])
        return self._upload_key
1248920
def key_bytes(self):
        
        return self.key.private_bytes(
            encoding=serialization.Encoding.DER,
            format=serialization.PrivateFormat.PKCS8,
            encryption_algorithm=serialization.NoEncryption(),
        )
914713
def todict(self):
        
        return {"f_key": hb_encode(self.f_key),
                "alpha_key": hb_encode(self.alpha_key),
                "chunks": self.chunks,
                "encrypted": self.encrypted,
                "iv": hb_encode(self.iv),
                "hmac": hb_encode(self.hmac)}