Can't tell, it's seems to be signing, that is it's kind of working, but the signature isn't verifying with openssl.
I'll send a bit of btc yourway graingert for getting the hash function to work.
Now however I have a related task, and 50BTC to the person who sorts this out for me.
That is, the signature can be verified using the public key and openssl on a server somewhere.
For bonus point get it working with openssl and ruby.
#data is whats signed
public_key.verify( OpenSSL::Digest::SHA512.new, signature, data )
My experience is that openssl expects binary for the signature (at least that's what it outputs)