If yes, how? Especially in PHP...
Hi,
Do you mean a
secp256k1 private key ? Anyway private keys are just numbers and in the case of
secp256k1 it is a 256bit long number. So you can get a 256bit long RSA private key,
which is not much secure... Why do you want to do that ?
Update : Since you updated your question here is the updated answer :
I want to sign a message with a Bitcoin address using PHP.
You cannot sign a message with an address (which is a hash of a public key), however you can sign a message using the private key used to derive this address.
You can sign a message using ECDSA on the secp256k1 using any lib (such as this, first search engine result :
https://github.com/kornrunner/php-secp256k1) which would be as simple as :
$signature = $secp256k1->sign($message, $privateKey);
You won't be able to provide a non-forgeable RSA signature from such a short private key.
Now, how do I convert WIF/HEX to the required format for signing?
The format will be depending on the library you use. However WIF is roughly a base58check encoding so you can easily get hex back from it.
or there are some custom crypto libraries available. But, my purpose is just to automate the signing process and hence I dont want to increase the overhead.
If you dont want to use secp256k1 you can use another sognature algorithm (I dont know which one the php standard library provides).