Ejemplo n.º 1
0
 /**
  *
  * @param <type> $text
  * @param <type> $mimetype
  * @param Magicsig $magicsig    Magicsig with private key available.
  *
  * @return MagicEnvelope object with all properties set
  *
  * @throws Exception of various kinds on signing failure
  */
 public function signMessage($text, $mimetype, Magicsig $magicsig)
 {
     assert($magicsig->privateKey instanceof Crypt_RSA);
     // Prepare text and metadata for signing
     $this->data = Magicsig::base64_url_encode($text);
     $this->data_type = $mimetype;
     $this->encoding = self::ENCODING;
     $this->alg = $magicsig->getName();
     // Get the actual signature
     $this->sig = $magicsig->sign($this->signingText());
 }