Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specified key is not a valid size for this algorithm #963

Closed
1 task done
rushsteve1 opened this issue Apr 18, 2022 · 6 comments
Closed
1 task done

Specified key is not a valid size for this algorithm #963

rushsteve1 opened this issue Apr 18, 2022 · 6 comments
Assignees
Labels
Type: Bug Issue is a bug

Comments

@rushsteve1
Copy link

rushsteve1 commented Apr 18, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Indexers are not added to the Sonarr/Radarr that have been added, instead an error is thrown (see below).

Expected Behavior

Indexers should be added to Sonarr/Radarr.

Steps To Reproduce

  1. Added Sonarr and Radarr as Apps
  2. Added their API keys, copied from their settings
  3. Set them to Full Sync or Add/Remove
  4. Hit Sync App Indexers
  5. Indexers in Sonarr/Radarr are not added, error below

Environment

- OS: Ubuntu 18.04
- Prowlarr: 0.2.0.1678
- Docker Install: 19.03.2
- Using Reverse Proxy: Yes, Apache
- Browser: Firefox 99

What branch are you running?

Develop

Trace Logs?

System.ArgumentException: Specified key is not a valid size for this algorithm. (Parameter 'rgbKey')
   at Internal.Cryptography.AesImplementation.CreateTransform(Byte[] rgbKey, Byte[] rgbIV, Boolean encrypting)
   at NzbDrone.Core.Security.ProtectionService.Protect(String text) in D:\a\1\s\src\NzbDrone.Core\Security\ProtectionService.cs:line 54
   at NzbDrone.Core.Download.DownloadMappingService.ConvertToProxyLink(Uri link, String serverUrl, Int32 indexerId, String file) in D:\a\1\s\src\NzbDrone.Core\Download\DownloadMappingService.cs:line 40
   at NzbDrone.Api.V1.Indexers.NewznabController.GetNewznabResponse(Int32 id, NewznabRequest request) in D:\a\1\s\src\Prowlarr.Api.V1\Indexers\NewznabController.cs:line 151
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Prowlarr.Http.Middleware.BufferingMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Prowlarr.Http\Middleware\BufferingMiddleware.cs:line 28
   at Prowlarr.Http.Middleware.IfModifiedMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Prowlarr.Http\Middleware\IfModifiedMiddleware.cs:line 41
   at Prowlarr.Http.Middleware.CacheHeaderMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Prowlarr.Http\Middleware\CacheHeaderMiddleware.cs:line 33
   at Prowlarr.Http.Middleware.UrlBaseMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Prowlarr.Http\Middleware\UrlBaseMiddleware.cs:line 27
   at Prowlarr.Http.Middleware.VersionMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Prowlarr.Http\Middleware\VersionMiddleware.cs:line 28
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task): Specified key is not a valid size for this algorithm. (Parameter 'rgbKey')

AB#3005

@rushsteve1 rushsteve1 added Status: Needs Triage New Issue needing triage Type: Bug Issue is a bug labels Apr 18, 2022
@bakerboy448
Copy link
Contributor

Please provide trace logs. Just the error spew is not helpful nor valid for bug reports

See the Wiki link for how to get and provide trace logs that is within the bug report template.

@rushsteve1
Copy link
Author

Sorry about that, here is the trace log file
prowlarr.trace.txt

@bakerboy448
Copy link
Contributor

bakerboy448 commented Apr 18, 2022

2022-04-18 20:16:52.4|Warn|HttpClient|HTTP Error - Res: [POST] https://rushsteve1.cronos.bysh.me/sonarr/api/v3/indexer: 500.InternalServerError
{
  "message": "Object reference not set to an instance of an object",

Sonarr sync issue is a Sonarr bug - fixed in develop; no ETA on the next main release
Sonarr/Sonarr@8d83b1d


2022-04-18 20:16:53.5|Warn|HttpClient|HTTP Error - Res: [POST] http://rushsteve1.cronos.bysh.me/radarr/api/v3/indexer: 400.BadRequest
[
  {
    "isWarning": false,
    "propertyName": "",
    "errorMessage": "Query successful, but no results in the configured categories were returned from your indexer. This may be an issue with the indexer or your indexer category settings.",
    "severity": "error"
  }
]

Radarr sync issues are not a bug. This is a support question. See the troubleshooting article.


2022-04-18 20:16:55.0|Error|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|An unhandled exception has occurred while executing the request.

[v0.2.0.1678] System.ArgumentException: Specified key is not a valid size for this algorithm. (Parameter 'rgbKey')

Context - https://gist.github.com/bakerboy448/e677fc74551883a6bce3cac3ce8cf83c

Prowlarr query when sync issue - this appears to be an issue with the response from TPB. Defer to @Qstick if this is a bug or not.

@rushsteve1
Copy link
Author

rushsteve1 commented Apr 18, 2022

I tried upgrading Sonarr to the develop branch version 3.0.7.1503
And I removed some possibly problematic indexes including TPB and RARBG

No luck, I am still having the same problems, neither Radarr or Sonarr ever gets the indexes. Trace attached.
prowlarr.trace.txt

@bakerboy448
Copy link
Contributor

Looks like it's now just narrowed down to the key error now.

2022-04-18 20:50:39.1|Error|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|An unhandled exception has occurred while executing the request.

[v0.2.0.1678] System.ArgumentException: Specified key is not a valid size for this algorithm. (Parameter 'rgbKey')

@Qstick
Copy link
Contributor

Qstick commented May 13, 2022

This happens as a result of using something other than a standard GUID as the apikey (which Prowlarr uses as the AES encryption key for download links), as AES keys can only be 128, 192, or 256 bits.

We'll have to generate and store a separate key which can't be edited to use for protecting links as it seems some people change their APIKey for deployment or something.

@Qstick Qstick self-assigned this May 13, 2022
@Qstick Qstick closed this as completed in 6783514 May 14, 2022
@bakerboy448 bakerboy448 removed the Status: Needs Triage New Issue needing triage label Jun 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Issue is a bug
Projects
None yet
Development

No branches or pull requests

3 participants