:publickey
and :privatekey
need to be expanded paths to the public and private key file locations on the disk. If your application works with the key data directly, you could try writing the data to tempfiles and passing in the paths to those files.
Just make sure to understand possible security risks when doing that.