|I might have understood this|
wrong but in you are signing with your public key
and verifying with your private key. It should be the
The purpose of signing a message is the people can verify it
by having your public key. You don't want to give out your
private key to people.
To sign a message, you should use the same operation as decrypt, not
encrypt. (d mod n).. (Dangerous to call the variable $d as in private
key, but then to send the public key (e) as argument).