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

C#类库中,Pingpp.cs下SetPrivateKeyPath的bug #6

Open
ZXYCir opened this issue Aug 12, 2016 · 1 comment
Open

C#类库中,Pingpp.cs下SetPrivateKeyPath的bug #6

ZXYCir opened this issue Aug 12, 2016 · 1 comment

Comments

@ZXYCir
Copy link

ZXYCir commented Aug 12, 2016

4.6中,由于安全性问题,这个方法会出现bug。
public static void SetPrivateKeyPath(string newPrivateKeyPath)
{
try
{
var privateKeyFile = new FileStream(newPrivateKeyPath, FileMode.Open);
PrivateKey = FormatPrivateKey((new StreamReader(privateKeyFile)).ReadToEnd());
privateKeyFile.Close();
}
catch (IOException ex)
{
throw new PingppException("Private key read error. " + ex);
}
}
请使用下面的安全方法:
public static void SetPrivateKeyPath(string newPrivateKeyPath)
{
try
{
var privateKeyFile = new FileStream(newPrivateKeyPath, FileMode.Open);
PrivateKey = FormatPrivateKey((new StreamReader(privateKeyFile)).ReadToEnd());
privateKeyFile.Close();
}
catch (IOException ex)
{
throw new PingppException("Private key read error. " + ex);
}
}

@samurai00
Copy link
Contributor

上下两段代码我没有看到任何区别,请再确认一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants