How to secure API KEY in .net MAUI?

ASAD ALAM 1 Reputation point
2022-10-16T08:11:56.553+00:00

I am new to .Net MAUI but fairly experienced with ASP.NET CORE and Blazor. I'm developing a MAUI application that will allow a user to integrate with third-party services using API keys. My issue is, I'd like to store API Key securely and nobody can extract it using reverse engineering. How can protect API Key and other secrets?

Thanks

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,487 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,915 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
335 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 65,131 Reputation points
    2022-10-16T15:33:55.61+00:00

    You can not safely ship an api key with the app. Normally the app would fetch the key (after validation of the user) from a trusted server and store the key securely as suggested above.

    How to steal a key

    https://approov.io/blog/how-to-extract-an-api-key-from-a-mobile-app-with-static-binary-analysis

    1 person found this answer helpful.
    0 comments No comments

  2. Sreeju Nair 12,346 Reputation points
    2022-10-16T08:50:11.58+00:00

    To store secrets in your application, you may use SecureStorage.

    Refer: https://video2.skills-academy.com/en-us/dotnet/maui/platform-integration/storage/secure-storage?tabs=windows

    Hope this helps


  3. Bruce (SqlWork.com) 65,131 Reputation points
    2023-09-24T19:33:47.28+00:00

    you should supply a web service api that you maui app calls. this web service should have the api keys. You should have the Maui app register the user with your api. Then the Maui app can use the user registration to access the site. If you use access tokens, you can store the token in a secure store on the client.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.