encryption decryption function in php

Posted by parthav on Stack Overflow See other posts from Stack Overflow or by parthav
Published on 2010-03-15T05:10:49Z Indexed on 2010/03/15 5:19 UTC
Read the original article Hit count: 421

Filed under:
|
|
import gnupg, urllib

retk = urllib.urlopen("http://keyserver.pramberger.at/pks/"
"lookup?op=get&search=userid for the key is required")
pub_key = retk.read()
#print pub_key
gpg = gnupg.GPG(gnupghome="/tmp/foldername", verbose=True)
print "Import the Key :", gpg.import_keys(pub_key).summary()
print "Encrypt the Message:"
msg = "Hellllllllllo"
uid = "userid that has the key on public key server"
enc = gpg.encrypt(msg, uid,always_trust=True)
print "*The enc content***************************== ", enc

this function written in python gives me encrypted message.The encryption is done using the public key which i am getting from public key server(pramberger.at).

Now how can i implement the same functionality (getting the key from any public key server and using that key encrypt the message) in php

© Stack Overflow or respective owner

Related posts about php

Related posts about encryption