public function publicKeyInfo($cert)
{
/* Make sure the certificate is valid. */
$key_info = openssl_x509_parse($cert);
if (!is_array($key_info) || !isset($key_info['subject'])) {
throw new Horde_Crypt_Exception(_("Not a valid public key."));
}
/* Add key to the user's address book. */
$email = $this->_smime->getEmailFromKey($cert);
if (is_null($email)) {
throw new Horde_Crypt_Exception(_("No email information located in the public key."));
}
/* Get the name corresponding to this key. */
if (isset($key_info['subject']['CN'])) {
$name = $key_info['subject']['CN'];
} elseif (isset($key_info['subject']['OU'])) {
$name = $key_info['subject']['OU'];
} else {
$name = $email;
}
return array($name, $email);
}