/** * Get the thumbprint of the X509 certificate this key represents. * * @return string */ public function getX509Thumbprint() { if ($this->keyType != self::TYPE_PUBLIC) { return null; } $certs = Pem::parseKeyFromPemFormat($this->key, Pem::PEM_TYPE_CERTIFICATE_X509); return strtolower(sha1(base64_decode($certs[0]))); }
public function testParseKeyFromPemFormat() { $keys = Pem::parseKeyFromPemFormat($this->cert, PEM::PEM_TYPE_CERTIFICATE_X509); $keyString = array_pop($keys); $this->assertEquals($keyString, $this->keyString); }