Question

I'm accessing a remote server and I have to POST a username and a password to retrieve a XML-file. I'm using PHP.

What would be the way to store that username and password securely and make it readable again so I can POST it to the server. It's a server I don't own, so I have to pass a non-encrypted username and password.

Was it helpful?

Solution

If u dont own this server, u cant decrypt username and password on this serwer, u need to send clean post. U can store data, in db, session, depending on what you want to write. Simple crypt and decrypt string.

$key_value = $username;
$encrypted_text = mcrypt_ecb(MCRYPT_DES, $key_value, $plain_text, MCRYPT_ENCRYPT); 
$decrypted_text = mcrypt_ecb(MCRYPT_DES, $key_value, $encrypted_text, MCRYPT_DECRYPT);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top