prithvi
prithvi

Reputation: 11

encryption in php

$key = file_get_contents('http://keyserver.pramberger.at/pks/lookup?op=get&search=userid');

this code gives me public key with the html tag .how to extract the public key block form begin pgp public key block ---to---- end pgp public key block and using this public key i need to encrypt the data .i need to do it in php.

Upvotes: 1

Views: 234

Answers (2)

Benjamin Delichere
Benjamin Delichere

Reputation: 408

or that

$pgp_key = trim(preg_replace('/(.*)<pre>(.*)<\/pre>(.*)/s','\2',$key));

Upvotes: 0

Frraaz
Frraaz

Reputation: 21

try this
preg_match('/PUBLIC KEY BLOCK-----\s(.*?)\s-----END PGP/s', $data, $match);
echo $match[1]; //returns the key

Upvotes: 2

Related Questions