duandang2838 2014-09-03 22:39
浏览 26
已采纳

从另一台服务器访问RSA密钥

Part of my decryption process is using a RSA private key to decrypt part of my data. I store my private RSA Key on a separate server (as well as the password for the private RSA Key) from where I process the decryption request.

Decryption of information in my SQL database happens a lot. So I am trying to figure out the most efficient way to grab my key and the password to the key so I don't bog down the server too much.

note: I do not know how much strain this puts on a server so I may be completely wrong

Right now, the only way I can think about doing it is SSH'ing into the server and grabbing the file contents and then closing the request.

Does anyone have any suggestions?

Something along the lines of this:

$connection = ssh2_connect('domain.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$sftp = ssh2_sftp($connection);

$file = fopen("ssh2.sftp://$sftp/path/to/file", 'r');
  • 写回答

1条回答 默认 最新

  • duanmei2459 2014-09-03 22:52
    关注

    I dont know why u store ur RSA key and password on another server because if your Server can access them using any way, a hacker can do the same thing. In your code, the hacker just need to SSH into the server using the hardcoded username and password.

    In case of SSH connection, it is also not a good idea put them into part of web request ( I assume it is a web application since I saw PHP :) ). SSH connection takes a huge amount of time to establish.

    A lighter solution is to create a https web server on your RSA key server and only white list your Web server ip address. It is same encryption as SSH (SSL) but much faster.

    Again, it seems not necessary to put the RSA key and password on another server according to your scenario.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么