Beispiel #1
0
 /**
  *
  * @see \CryptoUtil\Crypto\Crypto::sign()
  */
 public function sign($data, PrivateKeyInfo $privkey_info, SignatureAlgorithmIdentifier $algo)
 {
     $this->_checkSignatureAlgoAndKey($algo, $privkey_info->algorithmIdentifier());
     $result = openssl_sign($data, $signature, $privkey_info->toPEM(), $this->_algoToDigest($algo));
     if (false === $result) {
         throw new \RuntimeException("openssl_sign() failed: " . $this->_getLastError());
     }
     return new Signature($signature);
 }