bitcoind has some unit tests that are exactly what you want; you could copy one, put in your own values, and run it as a bitcoind test. You could do it with openssl but you'd probably need to convert the pubkey into an openssl-compatible format somehow.