Example #1
0
 /**
  * Parse serialized identity certificate
  *
  * Parses a serialized, signed identity certificate and check if it's valid by
  * checking the signature against the public key of the issuer.
  *
  * @access public
  * @static
  * @param string $signedObject Signed identity certificate
  * @param AbstractPublicKey $publicKey Public key of the issuer
  * @return Cert Instance of the identity certificate
  */
 public static function parse($signedObject, $publicKey)
 {
     $token = WebToken::parse($signedObject);
     //    try {
     if (!$token->verify($publicKey)) {
         throw new \Exception("cert was not valid signed");
     }
     /*  } catch (\Exception $x) {
         // can't extract components
         throw new \Exception("cert was not valid signed");
       }*/
     $params = $token->getPayload();
     return Cert::deserialize($params);
 }