/**
  * Constructs a new secure cookie.
  *
  * The user GID has to be set in order to send a secure cookie.
  *
  * @param HashFunction $hmacFunction the HMAC function
  * @param HashFunction $hmacKeyFunction the HMAC key function
  * @param SymmetricCypher $symmetricCypher the symmetric cypher
  * @param string $secretKey the secret key
  * @param GID $gid a GID instance
  * @param string $sessionIdentifier a unique session identifier
  * @param string|null $userGID the GID of the current user or <code>null</code> if the GID is
  * not known
  * @throws InvalidArgumentException if the HMAC key function provides a key size too small for
  * creating a key for the symmetric cypher
  */
 public function __construct(HashFunction $hmacFunction, HashFunction $hmacKeyFunction, SymmetricCypher $symmetricCypher, $secretKey, GID $gid, $sessionIdentifier, $userGID = null)
 {
     $this->hmacFunction = $hmacFunction;
     $this->hmacKeyFunction = $hmacKeyFunction;
     $this->symmetricCypher = $symmetricCypher;
     $this->secretKey = $secretKey;
     $this->gid = $gid;
     $this->sessionIdentifier = $sessionIdentifier;
     $this->userGID = $userGID;
     $requiredSize = $symmetricCypher->getKeySize();
     $keySize = $hmacKeyFunction->getHashLength();
     if ($keySize < $requiredSize) {
         throw new InvalidArgumentException('Warning: Invalid combination of algorithms for secure Cookie, HMAC Key function must produce a key longer or equal to the symmetric cypher key size.');
     }
 }