0
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
用python編寫的這個函數給了我加密的消息。加密是使用我從公鑰服務器(pramberger.at)獲得的公鑰完成的。加密解密功能在php
現在我怎麼能在php中實現相同的功能(從任何公鑰服務器獲取密鑰並使用該密鑰加密消息)。