parameters: (
      key: Dict[str, Union[str, List[str]]])
return_statement: return proto_key
docstring: Converts a JWK into a JwtEcdsaPublicKey.
docstring_summary: Converts a JWK into a JwtEcdsaPublicKey.
docstring_tokens: Converts a JWK into a JwtEcdsaPublicKey .
function: def _convert_to_rsa_ssa_pkcs1_key(
      key: Dict[str, Union[str, List[str]]]) -> tink_pb2.Keyset.Key:
    """Converts a JWK into a JwtEcdsaPublicKey."""
    public_key = jwt_rsa_ssa_pkcs1_pb2.JwtRsaSsaPkcs1PublicKey()
    algorithm = _RSA_SSA_PKCS1_NAME_TO_ALGORITHM.get(key['alg'], None)
    if not algorithm:
      raise tink.TinkError('unknown RSA SSA PKCS1 algorithm')
    if key.get('kty', None) != 'RSA':
      raise tink.TinkError('invalid kty')
    _validate_use_and_key_ops(key)
    if ('p' in key or 'q' in key or 'dp' in key or 'dq' in key or 'd' in key or
        'qi' in key):
      raise tink.TinkError('importing RSA private keys is not implemented')
    public_key.algorithm = algorithm
    public_key.n = _base64_decode(key['n'])
    public_key.e = _base64_decode(key['e'])
    if 'kid' in key:
      public_key.custom_kid.value = key['kid']
    proto_key = tink_pb2.Keyset.Key()
    proto_key.key_data.type_url = _JWT_RSA_SSA_PKCS1_PUBLIC_KEY_TYPE
    proto_key.key_data.value = public_key.SerializeToString()
    proto_key.key_data.key_material_type = tink_pb2.KeyData.ASYMMETRIC_PUBLIC
    proto_key.output_prefix_type = tink_pb2.RAW
    proto_key.status = tink_pb2.ENABLED
    return proto_key
function_tokens: def _convert_to_rsa_ssa_pkcs1_key ( key : Dict [ str , Union [ str , List [ str ] ] ] ) -> tink_pb2 . Keyset . Key : public_key = jwt_rsa_ssa_pkcs1_pb2 . JwtRsaSsaPkcs1PublicKey ( ) algorithm = _RSA_SSA_PKCS1_NAME_TO_ALGORITHM . get ( key [ 'alg' ] , None ) if not algorithm : raise tink . TinkError ( 'unknown RSA SSA PKCS1 algorithm' ) if key . get ( 'kty' , None ) != 'RSA' : raise tink . TinkError ( 'invalid kty' ) _validate_use_and_key_ops ( key ) if ( 'p' in key or 'q' in key or 'dp' in key or 'dq' in key or 'd' in key or 'qi' in key ) : raise tink . TinkError ( 'importing RSA private keys is not implemented' ) public_key . algorithm = algorithm public_key . n = _base64_decode ( key [ 'n' ] ) public_key . e = _base64_decode ( key [ 'e' ] ) if 'kid' in key : public_key . custom_kid . value = key [ 'kid' ] proto_key = tink_pb2 . Keyset . Key ( ) proto_key . key_data . type_url = _JWT_RSA_SSA_PKCS1_PUBLIC_KEY_TYPE proto_key . key_data . value = public_key . SerializeToString ( ) proto_key . key_data . key_material_type = tink_pb2 . KeyData . ASYMMETRIC_PUBLIC proto_key . output_prefix_type = tink_pb2 . RAW proto_key . status = tink_pb2 . ENABLED return proto_key