<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: NiFi Registry OIDC: IllegalArgumentException (RS256 vs HS256) when passing Keycloak Access Token directly to API in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Registry-OIDC-IllegalArgumentException-RS256-vs-HS256/m-p/413236#M253950</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/126691"&gt;@TyTheNiFiGuy&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for being part of our community.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was checking that NiFi Registry does not have support for&amp;nbsp;&lt;SPAN&gt;asymmetric RSA such as RS256.&amp;nbsp;&lt;BR /&gt;That is a limitation itself, and not a problem in your token.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The log do tell this:&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;2026-01-02 18:22:27,220 INFO [NiFi logging handler] org.apache.nifi.registry.StdOut Caused by: java.lang.IllegalArgumentException: The default resolveSigningKey(JwsHeader, Claims) implementation cannot be used for asymmetric key algorithms (RSA, Elliptic Curve).&amp;nbsp; Override the resolveSigningKey(JwsHeader, Claims) method instead and return a Key instance appropriate for the RS256 algorithm.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Checking the code, I see that only HS256 is supported:&amp;nbsp;&lt;BR /&gt;&lt;FONT face="terminal,monaco"&gt;private static final MacAlgorithm SIGNATURE_ALGORITHM = Jwts.SIG.HS256;&lt;/FONT&gt;&lt;BR /&gt;&lt;A href="https://github.com/apache/nifi/blob/9998b6d9ce21a66db240ff6131fc882002285e8b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java#L53C1-L54C1" target="_blank"&gt;https://github.com/apache/nifi/blob/9998b6d9ce21a66db240ff6131fc882002285e8b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java#L53C1-L54C1&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jan 2026 21:44:02 GMT</pubDate>
    <dc:creator>vafs</dc:creator>
    <dc:date>2026-01-05T21:44:02Z</dc:date>
    <item>
      <title>NiFi Registry OIDC: IllegalArgumentException (RS256 vs HS256) when passing Keycloak Access Token directly to API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Registry-OIDC-IllegalArgumentException-RS256-vs-HS256/m-p/413224#M253945</link>
      <description>&lt;P&gt;Environment:&lt;BR /&gt;&lt;STRONG&gt;NiFi Registry:&lt;/STRONG&gt; [2.4.0]&lt;BR /&gt;&lt;STRONG&gt;Deployment:&lt;/STRONG&gt; Kubernetes, Helm, Zarf&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN class="citation-1"&gt;Authentication:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="citation-1 citation-end-1"&gt; OIDC via Keycloak&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;Client:&lt;/STRONG&gt; Golang automation job running in the cluster&lt;/P&gt;&lt;P&gt;Goal:&amp;nbsp;I am running a Golang job in Kubernetes to perform initial configuration of the NiFi Registry (creating buckets/flows). The job fetches an Access Token&amp;nbsp;from Keycloak&amp;nbsp; and sends it in the Authorization: Bearer header to the Registry API endpoint: &lt;STRONG&gt;GET /nifi-registry-api/access&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Issue:&amp;nbsp;The request fails with a 401, and the NiFi Registry logs show an &lt;STRONG&gt;IllegalArgumentException&lt;/STRONG&gt; indicating an algorithm mismatch in the JWT signature validation&lt;BR /&gt;&lt;BR /&gt;The logs related to this request are attached.Analysis of these logs&lt;BR /&gt;&lt;BR /&gt;The Access Token issued by Keycloak is signed using RS256&amp;nbsp;(asymmetric RSA), which requires a public key to verify. However, the stack trace explicitly shows an &lt;STRONG&gt;IllegalArgumentException&lt;/STRONG&gt; stating that the validation logic cannot handle asymmetric algorithms. It seems that the Registry's &lt;STRONG&gt;JwtIdentityProvider&lt;/STRONG&gt; is attempting to validate the incoming token using HMAC.&lt;BR /&gt;&lt;BR /&gt;We don't see this mismatch with NiFi itself, only the NiFi registry. We are able to do configuration and setup on the NiFi application, but when trying to access NiFi Registry with a token from keycloak, we see this token error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there a way to configure the registry to accept RS256 tokens? Is there an alternative approach to making requests against the NiFi Registry using some sort of service account? We need to have the NiFi Registry configured with keycloak, but we also need this configuration job to run at deployment time to do setup. We won't have users created through the UI yet that we can leverage.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I can also post the decoded token contents if that helps, but it seems like it's an issue with the actual token signing algorithms and not the content of the token. At least that's my assumption.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jan 2026 20:32:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-Registry-OIDC-IllegalArgumentException-RS256-vs-HS256/m-p/413224#M253945</guid>
      <dc:creator>TyTheNiFiGuy</dc:creator>
      <dc:date>2026-01-02T20:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi Registry OIDC: IllegalArgumentException (RS256 vs HS256) when passing Keycloak Access Token directly to API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Registry-OIDC-IllegalArgumentException-RS256-vs-HS256/m-p/413236#M253950</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/126691"&gt;@TyTheNiFiGuy&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for being part of our community.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was checking that NiFi Registry does not have support for&amp;nbsp;&lt;SPAN&gt;asymmetric RSA such as RS256.&amp;nbsp;&lt;BR /&gt;That is a limitation itself, and not a problem in your token.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The log do tell this:&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;2026-01-02 18:22:27,220 INFO [NiFi logging handler] org.apache.nifi.registry.StdOut Caused by: java.lang.IllegalArgumentException: The default resolveSigningKey(JwsHeader, Claims) implementation cannot be used for asymmetric key algorithms (RSA, Elliptic Curve).&amp;nbsp; Override the resolveSigningKey(JwsHeader, Claims) method instead and return a Key instance appropriate for the RS256 algorithm.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Checking the code, I see that only HS256 is supported:&amp;nbsp;&lt;BR /&gt;&lt;FONT face="terminal,monaco"&gt;private static final MacAlgorithm SIGNATURE_ALGORITHM = Jwts.SIG.HS256;&lt;/FONT&gt;&lt;BR /&gt;&lt;A href="https://github.com/apache/nifi/blob/9998b6d9ce21a66db240ff6131fc882002285e8b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java#L53C1-L54C1" target="_blank"&gt;https://github.com/apache/nifi/blob/9998b6d9ce21a66db240ff6131fc882002285e8b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java#L53C1-L54C1&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 21:44:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-Registry-OIDC-IllegalArgumentException-RS256-vs-HS256/m-p/413236#M253950</guid>
      <dc:creator>vafs</dc:creator>
      <dc:date>2026-01-05T21:44:02Z</dc:date>
    </item>
  </channel>
</rss>

