php - 如何获得Steam公钥?

标签 php ssl encryption public-key steam-web-api

对于这个方法:

ISteamUserAuth

AuthenticateUser

Version: 1

HTTP Method: POST

Parameters:

Name: steamid

Type: uint64

Optional:

Description: Should be the users steamid, unencrypted.

Parameters:

Name: sessionkey

Type: rawbinary

Optional:

Description: Should be a 32 byte random blob of data, which is then encrypted with RSA using the Steam system's public key. Randomness is important here for security.

Parameters:

Name: encrypted_loginkey

Type: rawbinary

Optional:

Description: Should be the users hashed loginkey, AES encrypted with the sessionkey.

我需要 3 个参数。对于第二个参数sessionkey,我需要使用Steam系统的公钥对其进行加密。我究竟如何得到它?

经过一些研究,我发现我必须通过使用证书来获取公钥,它应该类似于 this。 .

我使用的是 php,因此我使用这段代码从证书中检索公钥:

<?php
$pub_key = openssl_pkey_get_public(file_get_contents('./cert.crt'));
$keyData = openssl_pkey_get_details($pub_key);
file_put_contents('./key.pub', $keyData['key']);
?>

我对使用哪个证书感到困惑。我是否使用 Steam 网站的证书? (cert.crt 就是证书)

最佳答案

我也有同样的疑问。我还没有尝试过,但是:

curl -X POST "http://store.steampowered.com/login/getrsakey/" 
     -d username="your_username"

给你一个RSA key ...

关于php - 如何获得Steam公钥?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27083356/

相关文章:

php - 具有获取值的表单

php - 多个 Web 应用程序之间的身份验证

javascript - 即使在使用 AJAX 进行 POST 后值不是 "0",PHP 也会回显 JavaScript 值 "0"

reactjs - 如何使用 HTTPS 启动 React 项目

ssl - Google Cloud - 连接超时,TLS - 握手

c - 访问 C 库的最 pythonic 方式是什么——例如,OpenSSL?

javascript - 使用 jsrsasign 使用加密的 RSA key 签名失败

php - laravel php artisan 迁移

java - Spring Security - BytesEncryptor - 没有获得正确的加密密码

ssl - 如何让 Websphere 将 keystore 更改从部署管理器传播到节点?