T
T
TechNOIR2020-06-26 16:22:24
C++ / C#
TechNOIR, 2020-06-26 16:22:24

C#. How to encrypt/decrypt a password to pass it to a console program as an argument?

Hello.

How to encrypt/decrypt a password to pass it to a console program as an argument?
Or in general, what is the best way to pass the password to the program? Without sewing it up inside the code.
Now I am passing it in open form as an argument

Thank you in advance

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2020-06-26
@firedragon

If your program is running in a trusted environment, then pass the password.
If you do not want to shine for strangers, modify the method

SigIn(string userName, string password){

}
SigIn(string userName, string passwordHash){

}

V
Vasily Bannikov, 2020-06-27
@vabka

Passing a username/password as an argument is fine. You can also pass it as an environment variable. I don’t see the point in encrypting, although you can still transfer interactively

I
Ilya Edrets, 2020-06-27
@ElijahCapricorn

Passing passwords through arguments is unsafe - they can be read by any other process with admin rights, this can be seen in the example of the task manager.
If you plan to run an application under Windows, then look towards Windows Credentials Manager. It provides a secure window for entering credentials, and also solves the problem of securely storing logins and passwords.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question