Example #1
0
 /**
  * Setter for the value of the private number
  *
  * @param string $number
  * @param string $type
  * @throws Zend_Crypt_DiffieHellman_Exception
  * @return Zend_Crypt_DiffieHellman
  */
 public function setPrivateKey($number, $type = self::NUMBER)
 {
     if ($type == self::BINARY) {
         $number = $this->_math->fromBinary($number);
     }
     if (!preg_match("/^\\d+\$/", $number)) {
         throw new Zend_Crypt_DiffieHellman_Exception('invalid parameter; not a positive natural number');
     }
     $this->_privateKey = (string) $number;
     return $this;
 }