GET UID/Public key certifiers

    :param client: Client to connect to the api
    :param search: UID or public key
    :return:
359150
async def certifiers_of(client: Client, search: str) -> dict:
    
    return await client.get(MODULE + '/certifiers-of/%s' % search, schema=CERTIFICATIONS_SCHEMA)
157581
def _get_certificate_raw(self, certificate_uid):
        
        cert_file_bytes = self.kv_store.get(certificate_uid_to_filename(certificate_uid))
        return cert_file_bytes
669541
def verify_sig(signed_request, secret, issuer=None, algorithms=None,
               expected_aud=None):
    
    if not issuer:
        issuer = _get_issuer(signed_request=signed_request)
    signed_request = _to_bytes(signed_request)
    app_req = _get_json(signed_request)

    # Check signature.
    try:
        jwt.decode(signed_request, secret, verify=True,
                   algorithms=algorithms, audience=expected_aud)
    except jwt.ExpiredSignatureError, exc:
        _re_raise_as(RequestExpired, '%s' % exc, issuer=issuer)
    except jwt.InvalidTokenError, exc:
        _re_raise_as(InvalidJWT,
                     'Signature verification failed: %s' % exc,
                     issuer=issuer)
    return app_req
370505
def verifyCert(self, cert):
        
        tbsCert = cert.tbsCertificate
        sigAlg = tbsCert.signature
        h = hash_by_oid[sigAlg.algorithm.val]
        sigVal = raw(cert.signatureValue)
        return self.verify(raw(tbsCert), sigVal, h=h, t='pkcs')
557536
def _get_client_side_certificate_subject():
    
    subject = django.core.cache.cache.get('client_side_certificate_subject')
    if subject is not None:
        return subject
    cert_pem = _get_client_side_certificate_pem()
    if cert_pem is None:
        return None
    subject = _extract_subject_from_pem(cert_pem)
    django.core.cache.cache.set('client_side_certificate_subject', subject)
    return subject
1071796
def _search_keys(text, keyserver, user=None):
    '''
    
    '''
    gpg = _create_gpg(user)
    if keyserver:
        _keys = gpg.search_keys(text, keyserver)
    else:
        _keys = gpg.search_keys(text)
    return _keys
1023792
def getAPIKey(self, keyID=None):
        
        kcfg = self.getKeyConfig(keyID)
        if 'key' not in kcfg:
            raise ConfigException('invalid config: missing api key')
        return kcfg['key']
385713
def lookup_cert(self, key):
        
        if not self.consumers:
            log.critical(("No consumers defined in settings."
                          "Have you created a configuration file?"))
            return None

        consumer = self.consumers.get(key)
        if not consumer:
            log.info("Did not find consumer, using key: %s ", key)
            return None
        cert = consumer.get('cert', None)
        return cert
349934
def get_api_key(key, request_options = {})
      client.get(Protocol.index_key_uri(name, key), :read, request_options)
    end
741695
def retrieve_crls(self, cert):
        

        if not self._allow_fetching:
            return self._crls

        if cert.issuer_serial not in self._fetched_crls:
            try:
                crls = crl_client.fetch(
                    cert,
                    **self._crl_fetch_params
                )
                self._fetched_crls[cert.issuer_serial] = crls
                for crl_ in crls:
                    try:
                        certs = crl_client.fetch_certs(
                            crl_,
                            user_agent=self._crl_fetch_params.get('user_agent'),
                            timeout=self._crl_fetch_params.get('timeout')
                        )
                        for cert_ in certs:
                            if self.certificate_registry.add_other_cert(cert_):
                                self._revocation_certs[cert_.issuer_serial] = cert_
                    except (URLError, socket.error):
                        pass
            except (URLError, socket.error) as e:
                self._fetched_crls[cert.issuer_serial] = []
                if self._revocation_mode == "soft-fail":
                    self._soft_fail_exceptions.append(e)
                    raise SoftFailError()
                else:
                    raise

        return self._fetched_crls[cert.issuer_serial]
1045985
def check_credentials(client):
    
    pid, uid, gid = get_peercred(client)

    euid = os.geteuid()
    client_name = "PID:%s UID:%s GID:%s" % (pid, uid, gid)
    if uid not in (0, euid):
        raise SuspiciousClient("Can't accept client with %s. It doesn't match the current EUID:%s or ROOT." % (
            client_name, euid
        ))

    _LOG("Accepted connection on fd:%s from %s" % (client.fileno(), client_name))
    return pid, uid, gid
1222770
def verify_pubkey_sig(self, message, sig):
        '''
        
        '''
        if self.opts['master_sign_key_name']:
            path = os.path.join(self.opts['pki_dir'],
                                self.opts['master_sign_key_name'] + '.pub')

            if os.path.isfile(path):
                res = verify_signature(path,
                                       message,
                                       binascii.a2b_base64(sig))
            else:
                log.error(
                    'Verification public key %s does not exist. You need to '
                    'copy it from the master to the minions pki directory',
                    os.path.basename(path)
                )
                return False
            if res:
                log.debug(
                    'Successfully verified signature of master public key '
                    'with verification public key %s',
                    self.opts['master_sign_key_name'] + '.pub'
                )
                return True
            else:
                log.debug('Failed to verify signature of public key')
                return False
        else:
            log.error(
                'Failed to verify the signature of the message because the '
                'verification key-pairs name is not defined. Please make '
                'sure that master_sign_key_name is defined.'
            )
            return False
645128
def _get_client(self):
        
        kwargs = self._storage_parameters

        # Handles unsecure mode
        if self._unsecure:
            kwargs = kwargs.copy()
            kwargs['ssl_compression'] = False

        return _swift.client.Connection(**kwargs)
1359224
def verify_plaintext(request, client_secret=None, resource_owner_secret=None):
    
    signature = sign_plaintext(client_secret, resource_owner_secret)
    match = safe_string_equals(signature, request.signature)
    if not match:
        log.debug('Verify PLAINTEXT failed')
    return match
903795
def get_public_key(key_info, ctx):
        
        x509_certificate = key_info.find(
            'ds:KeyInfo/ds:X509Data/ds:X509Certificate',
            namespaces={'ds': ns.DSigNs}
        )
        if x509_certificate is not None:
            return load_der_x509_certificate(
                base64.b64decode(x509_certificate.text),
                default_backend()
            ).public_key()
        if ctx.public_key is not None:
            return ctx.public_key
        if isinstance(ctx.private_key, (str, bytes)):
            return ctx.private_key
        return ctx.private_key.public_key()
1251567
def check_cached_certs(token, aud, cid)
      payload = nil

      # find first public key that validates this token
      @certs.detect do |key, cert|
        begin
          public_key = cert.public_key
          decoded_token = JWT.decode(token, public_key, !!public_key, { :algorithm => 'RS256' })
          payload = decoded_token.first

          # in Feb 2013, the 'cid' claim became the 'azp' claim per changes
          #  in the OIDC draft. At some future point we can go all-azp, but
          #  this should keep everything running for a while
          if payload['azp']
            payload['cid'] = payload['azp']
          elsif payload['cid']
            payload['azp'] = payload['cid']
          end
          payload
        rescue JWT::ExpiredSignature
          raise ExpiredTokenError, 'Token signature is expired'
        rescue JWT::DecodeError
          nil # go on, try the next cert
        end
      end

      if payload
        if !(payload.has_key?('aud') && payload['aud'] == aud)
          raise AudienceMismatchError, 'Token audience mismatch'
        end
        if cid && payload['cid'] != cid
          raise ClientIDMismatchError, 'Token client-id mismatch'
        end
        if !GOOGLE_ISSUERS.include?(payload['iss'])
          raise InvalidIssuerError, 'Token issuer mismatch'
        end
        payload
      else
        nil
      end
    end
613815
def login_by_cert
      @client = Google::APIClient.new

      key      = Google::APIClient::PKCS12.load_key(c('client_cert_file'), c('key_secret'))
      asserter = Google::APIClient::JWTAsserter.new(c('client_developer_email'), @scope, key)

      begin
        @client.authorization = asserter.authorize()
        @api = @client.discovered_api(@name_api, @version_api)
      rescue
        return false
      end

      return true
    end