How to encrypt data in php using Public/Private keys?

Posted by Xeoncross on Stack Overflow See other posts from Stack Overflow or by Xeoncross
Published on 2011-01-07T19:39:24Z Indexed on 2011/01/14 3:53 UTC
Read the original article Hit count: 221

Filed under:
|
|

I have a small string of some data (less than 1kb) that I would like to have user agents pass to other sites when they are sent from my site. In order for the other sites to verify that I was the one that created the string I though of two options.

  1. The server pings me back to confirm (like paypal, openid, etc..)
  2. I use public/private keys to prove I sent the message (like PGP, DKIM, etc..)

I don't want to setup HMAC because that would mean I have to use custom keys for each site which would be a pain.

Out of those two choices it seems that #2 would save on bandwidth which makes it seem like a better choice.

So how can you setup public/private key cryptography using PHP and are there any downsides?

© Stack Overflow or respective owner

Related posts about php

Related posts about cryptography