Get the signing key by exploring the JWKS endpoint of the OP.
422686
def retrieve_matching_jwk(self, token):
        """"""
        response_jwks = requests.get(
            self.OIDC_OP_JWKS_ENDPOINT,
            verify=self.get_settings('OIDC_VERIFY_SSL', True)
        )
        response_jwks.raise_for_status()
        jwks = response_jwks.json()

        # Compute the current header from the given token to find a match
        jws = JWS.from_compact(token)
        json_header = jws.signature.protected
        header = Header.json_loads(json_header)

        key = None
        for jwk in jwks['keys']:
            if jwk['kid'] != smart_text(header.kid):
                continue
            if 'alg' in jwk and jwk['alg'] != smart_text(header.alg):
                raise SuspiciousOperation('alg values do not match.')
            key = jwk
        if key is None:
            raise SuspiciousOperation('Could not find a valid JWKS.')
        return key
1309526
def getEndpoint(self):
        
        port = ''
        endpoint = ''
        keyConfig = self.getKeyConfig()
        if 'port' in keyConfig:
            port = ':' + keyConfig['port']
        elif self._data['port'] != self.PORT:
            port = ':' + self._data['port']
        if 'endpoint' in keyConfig:
            endpoint = keyConfig['endpoint']
        else:
            endpoint = self._data['endpoint']
        return 'https://%s%s/%s/' % (endpoint,
                                     port,
                                     self._data['api_version'])
349934
def get_api_key(key, request_options = {})
      client.get(Protocol.index_key_uri(name, key), :read, request_options)
    end
966165
def get(key, opts = {})
      response = api_execute(key_endpoint + key, :get, params: opts)
      Response.from_http_response(response)
    end
1035346
def verify(jwsjs):
    """"""
    get_ed25519ll()
    # XXX forbid duplicate keys in JSON input using object_pairs_hook (2.7+)
    recipients = jwsjs["recipients"]
    encoded_payload = binary(jwsjs["payload"])
    headers = []
    for recipient in recipients:
        assertTrue(len(recipient) == 2, "Unknown recipient key {0}".format(recipient))
        h = binary(recipient["header"])
        s = binary(recipient["signature"])
        header = json.loads(native(urlsafe_b64decode(h)))
        assertTrue(header["alg"] == ALG,
                   "Unexpected algorithm {0}".format(header["alg"]))
        if "alg" in header["jwk"] and "kty" not in header["jwk"]:
            header["jwk"]["kty"] = header["jwk"]["alg"]  # b/w for JWK < -08
        assertTrue(header["jwk"]["kty"] == ALG,  # true for Ed25519
                   "Unexpected key type {0}".format(header["jwk"]["kty"]))
        vk = urlsafe_b64decode(binary(header["jwk"]["vk"]))
        secured_input = b".".join((h, encoded_payload))
        sig = urlsafe_b64decode(s)
        sig_msg = sig+secured_input
        verified_input = native(ed25519ll.crypto_sign_open(sig_msg, vk))
        verified_header, verified_payload = verified_input.split('.')
        verified_header = binary(verified_header)
        decoded_header = native(urlsafe_b64decode(verified_header))
        headers.append(json.loads(decoded_header))

    verified_payload = binary(verified_payload)

    # only return header, payload that have passed through the crypto library.
    payload = json.loads(native(urlsafe_b64decode(verified_payload)))

    return headers, payload
701557
def get(self, key):
    '''
    '''
    key = self._service_key(key)
    return self._service_ops['get'](key)
1331994
def get_key_or_sym(hash, k)
      hash.fetch(k.to_sym, hash.fetch(k.to_s, nil))
    end
444749
def load(jwks):
    """"""
    sign_keys = {}
    verify_keys = {}
    try:
        keyset = json.loads(jwks)
        for key in keyset['keys']:
            for op in key['key_ops']:
                if op == 'sign':
                    k = sign_keys
                elif op == 'verify':
                    k = verify_keys
                else:
                    raise JWKError("Unsupported key operation: {}".format(op))
                if key['kty'] == 'oct':
                    k[key['kid']] = _Key(alg=key['alg'], key=base64.urlsafe_b64decode(key['k']))
                elif key['kty'] == 'EC':
                    alg, ec_key = _load_ecdsa(key, op == 'verify')
                    k[key['kid']] = _Key(alg=alg, key=ec_key)
                else:
                    raise JWKError("Unsupported key type: {}".format(key['kty']))
    except (KeyError, json.JSONDecodeError) as e:
        raise JWKError() from e
    keys = _KeySet(signers=MappingProxyType(sign_keys), verifiers=MappingProxyType(verify_keys))
    return keys
1226455
public KeySignature getKey() {
		for (int i = 0, j = size(); i < j; i++) {
			if (elementAt(i) instanceof KeySignature)
				return (KeySignature) elementAt(i);
		}
		return new KeySignature(Note.C, KeySignature.MAJOR);
	}
672560
def get_iss(self, key):
        
        _state = self.get_state(key)
        if not _state:
            raise KeyError(key)
        return _state['iss']
1320398
private function checkOperation(JWKInterface $key, $usage)
    {
        $ops = $key->get('key_ops');
        if (!is_array($ops)) {
            $ops = [$ops];
        }
        switch ($usage) {
            case 'verification':
                Assertion::inArray('verify', $ops, 'Key cannot be used to verify a signature');

                return true;
            case 'signature':
                Assertion::inArray('sign', $ops, 'Key cannot be used to sign');

                return true;
            case 'encryption':
                Assertion::true(in_array('encrypt', $ops) || in_array('wrapKey', $ops), 'Key cannot be used to encrypt');

                return true;
            case 'decryption':
                Assertion::true(in_array('decrypt', $ops) || in_array('unwrapKey', $ops), 'Key cannot be used to decrypt');

                return true;
            default:
                throw new \InvalidArgumentException('Unsupported key usage.');
        }
    }
553979
def get_key(key_name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        key = conn.get_key_pair(key_name)
        log.debug("the key to return is : %s", key)
        if key is None:
            return False
        return key.name, key.fingerprint
    except boto.exception.BotoServerError as e:
        log.debug(e)
        return False
532182
async function _verifyToken (jwksClient, token) {
  const decoded = jwt.decode(token, { complete: true })
  const signingKey = await jwksClient.getSigningKeyAsync(decoded.header.kid)
  return jwt.verifyAsync(token, signingKey.publicKey || signingKey.rsaPublicKey)
}
1167825
def crypto_sign(msg, sk):
    """"""
    if len(sk) != SECRETKEYBYTES:
        raise ValueError("Bad signing key length %d" % len(sk))
    vkbytes = sk[PUBLICKEYBYTES:]
    skbytes = sk[:PUBLICKEYBYTES]
    sig = djbec.signature(msg, skbytes, vkbytes)
    return sig + msg
841122
def _get_signing_jwk_key_set(jwt_issuer):
    
    key_set = KEYS()

    # asymmetric keys
    signing_jwk_set = settings.JWT_AUTH.get('JWT_PUBLIC_SIGNING_JWK_SET')
    if signing_jwk_set:
        key_set.load_jwks(signing_jwk_set)

    # symmetric key
    key_set.add({'key': jwt_issuer['SECRET_KEY'], 'kty': 'oct'})

    return key_set
1192582
async def fetch_signatures(endpoint, protocol, idgen):
        """"""
        async with aiohttp.ClientSession() as session:
            req = {
                "method": "getMethodTypes",
                "params": [''],
                "version": "1.0",
                "id": next(idgen),
            }

            if protocol == ProtocolType.WebSocket:
                async with session.ws_connect(endpoint, timeout=2) as s:
                    await s.send_json(req)
                    res = await s.receive_json()
                    return res
            else:
                res = await session.post(endpoint, json=req)
                json = await res.json()

                return json
739948
def get_key_from_cmdline(parser, args):
    """"""
    if args.keyfiles:
        signing_key = open(args.keyfiles[0], 'rb').read()
        bits = get_keysize(signing_key)
        if bits == 2048:
            signing_algorithm = 'sha1'
        elif bits == 4096:
            signing_algorithm = 'sha384'
        else:
            parser.error("Unsupported key size {} from key {}".format(bits, args.keyfiles[0]))

        print("Using {} to sign using algorithm {!s}".format(args.keyfiles[0], signing_algorithm))
    else:
        signing_key = None
        signing_algorithm = None

    return signing_key, signing_algorithm