Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param ECPublicKeyJWK $pub_key
  * @param ECPrivateKeyJWK $priv_key
  */
 protected function __construct(ECPublicKeyJWK $pub_key, ECPrivateKeyJWK $priv_key = null)
 {
     $curve = $pub_key->curveParameter()->value();
     if ($this->_curveName() != $curve) {
         throw new \InvalidArgumentException("Key with " . $this->_curveName() . " curve expected, got {$curve}.");
     }
     $this->_publicKey = $pub_key;
     $this->_privateKey = $priv_key;
     $key_size = $pub_key->curveParameter()->keySizeBits();
     $this->_signatureSize = intval(ceil($key_size / 8) * 2);
 }