How to get Steam public key?

4.2k views Asked by At

For this method:

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.

I need 3 parameters. For the second parameter sessionkey, I need to encrypt it using the Steam system's public key. How exactly do I get that?

After some research I figured out that I have to get a public key by using a certificate, and it should look like this.

I am using php, and thus I am using this code to retrieve a public key from a certificate:

<?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']);
?>

I am confused as to which certificate do I use. Do I use the certificate of the Steam website? (cert.crt would be the certificate)

1

There are 1 answers

0
André Rodrigues On

I have the same doubt. I'd not tried it yet, but:

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

Gives you a RSA key...