securestring

PowerShell script to pass SecureString to Plink as account and sudo passwords

三世轮回 提交于 2019-12-08 08:28:41
问题 I'm trying to use Powershell (in order to be able to mask the password) to run Plink command on remote Linux machine to give top 20 directories under /opt... It connects, password is properly masked but no results Write-output shows the assembled command string is correct... but it just appears to hang and does not return results. could the it be that the write-output results is different than what plink actually sends? When I copy the write-output to cmd prompt and directly run it, it works

Password encryption using SecureString for plink.exe command

柔情痞子 提交于 2019-12-08 05:44:33
问题 I would like to encrypt a password in PowerShell I tried this : In CLI : Read-Host -prompt "Password ?" -AsSecureString | ConvertFrom-SecureString | out-file "D:\root.pwd" In my script.ps1 : $pwsNAS = Get-Content "D:\root.pwd" | ConvertTo-SecureString plink.exe root@192.168.x.y -pw $pwdNAS df But it doesn't work... I tried with credentials, but it doesn't seems to be better... (My password doesn't have any space or accented character) Any idea? 回答1: Of course it doesn't work. plink expects a

How do a use a SecureString to create a SHA1 or SHA512 Hash?

坚强是说给别人听的谎言 提交于 2019-12-08 01:54:45
问题 I would like to use a SecureString varible within VB.NET and convert that to a SHA1 or SHA512 hash. How would I securely convert the SecureString to the Byte array that HashAlgorithm.ComputeHash will accept? 回答1: What about that, if we avoid the only used String instance (output) and replace it with a character array. This would enable us to wipe this array after use: public static String SecureStringToMD5( SecureString password ) { int passwordLength = password.Length; char[] passwordChars =

PowerShell script to pass SecureString to Plink as account and sudo passwords

≡放荡痞女 提交于 2019-12-07 08:00:31
I'm trying to use Powershell (in order to be able to mask the password) to run Plink command on remote Linux machine to give top 20 directories under /opt... It connects, password is properly masked but no results Write-output shows the assembled command string is correct... but it just appears to hang and does not return results. could the it be that the write-output results is different than what plink actually sends? When I copy the write-output to cmd prompt and directly run it, it works (well it still requests the password a second time because of sudo, but it does work and returns the

How do a use a SecureString to create a SHA1 or SHA512 Hash?

若如初见. 提交于 2019-12-06 06:33:48
I would like to use a SecureString varible within VB.NET and convert that to a SHA1 or SHA512 hash. How would I securely convert the SecureString to the Byte array that HashAlgorithm.ComputeHash will accept? What about that, if we avoid the only used String instance (output) and replace it with a character array. This would enable us to wipe this array after use: public static String SecureStringToMD5( SecureString password ) { int passwordLength = password.Length; char[] passwordChars = new char[passwordLength]; // Copy the password from SecureString to our char array IntPtr passwortPointer =

Rfc2898DeriveBytes + PBKDF2 + SecureString is it possible to use a secure string instead of a string?

↘锁芯ラ 提交于 2019-12-06 03:41:39
问题 I've a function GetPassword , that returns a SecureString type. When I pass this secure string to Rfc2898DeriveBytes to generate a key, Visual Studio shows an error. My limited knowledge tells me that it is because Rfc2898DeriveBytes accepts only a string and not a secure string. Is there a workaround to this? //read the password from terminal Console.Write("Insert password"); securePwd = myCryptography.GetPassword(); //dont know why the salt is initialized like this byte[] salt = new byte[]

Securing a password input in c# dotnet core console app

梦想的初衷 提交于 2019-12-06 03:03:08
long time lurker here finally having a question that I'm not seeing. I am writing a c# console application in dotnet core and trying to allow a user to input a password, and am concerned about security, particularly memory dumping. Following: Password masking console application my understanding is that a password stored as a string variable could be exposed through a memory dump ( reference ). SecureString would normally be the way to go here but doesn't seem to be supported in dotnet core . I've tried to modify the code to use a char array, because my limited understanding is that it is not

using securestring for a sql connection

柔情痞子 提交于 2019-12-05 04:43:34
I want to use a SecureString to hold a connection string for a database. But as soon as I set the SqlConnection object's ConnectionString property to the value of the securestring surely it will become visible to any other application that is able to read my application's memory? I have made the following assumptions: a) I am not able to instantiate a SqlConnection object outside of managed memory b) any string within managed memory can be read by an application such as Hawkeye Joe Your absolutely right the SecureString does not provide you with any benefit when you need to pass the string to

Put SecureString into PasswordBox

孤街醉人 提交于 2019-12-05 03:15:57
I have an existing SecureString that I would like to put into a PasswordBox without revealing the .Password . Can this be done? For example: tbPassword.SecurePassword = DecryptString(Properties.Settings.Default.proxyPassword); In this case DecryptString produces a SecureString. However, SecurePassword is a read-only property so I can't assign a value to it. You can't. However, what you can do is put placeholder text in it's place (it can even be "placeholder" , we are only using it to make a few dots to show up in the box). After you put the placeholder in, when you go to retrieve the "current

Rfc2898DeriveBytes + PBKDF2 + SecureString is it possible to use a secure string instead of a string?

大城市里の小女人 提交于 2019-12-04 08:21:56
I've a function GetPassword , that returns a SecureString type. When I pass this secure string to Rfc2898DeriveBytes to generate a key, Visual Studio shows an error. My limited knowledge tells me that it is because Rfc2898DeriveBytes accepts only a string and not a secure string. Is there a workaround to this? //read the password from terminal Console.Write("Insert password"); securePwd = myCryptography.GetPassword(); //dont know why the salt is initialized like this byte[] salt = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xF1, 0xF0, 0xEE, 0x21, 0x22, 0x45 }; try { //PBKDF2