public function _parseOutputText($text){ /* EXAMPLE INPUT: gpg: Signature made Wed 18 Nov 2015 01:22:49 PM EST using RSA key ID B04EFAD6 gpg: Good signature from "Core Plus Test Key (Just a test key for phpunit) <*****@*****.**>" Primary key fingerprint: 4E73 30EB 2A84 D747 9B71 9FF3 3F20 C906 B04E FAD6 */ preg_match('/gpg: Signature made ([a-zA-Z 0-9:+-]*) using ([a-zA-Z]*) key ID ([A-F0-9]*).*gpg: Good signature from "([^"]*)".*Primary key fingerprint: ([A-F0-9 ]*).*/s', $text, $matches); $this->isValid = (strpos('gpg: Good Signature from', $text) === false); $this->dateTime = $matches[1]; $this->fingerprint = str_replace(' ', '', $matches[5]); // Remove spaces/formatting. $this->keyID = $matches[3]; $this->encType = $matches[2]; $split = GPG::ParseAuthorString($matches[4]); $this->signingEmail = $split['email']; $this->signingName = $split['name']; }
protected static function _ParseSubUIDLine5($parts, UID $uid){ /* * (0-index of keys) * 0. Field: Type of record * 1. Field: Key name and/or email * 2. Field: Creation Date (in UTC). * 3. Field: ??? * 4. Field: ??? */ //$uid->validity = $parts[1]; $uid->created = $parts[2]; //$uid->expires = $parts[6]; //$uid->serial = $parts[7]; $split = GPG::ParseAuthorString($parts[1]); $uid->fullname = $split['name']; $uid->email = $split['email']; $uid->comment = $split['comment']; }