/** * Split a key (i.e. master key -> encryption key, authentication key) * * @return Key[] */ public function splitSymmetricKey(Key $key, string $salt) : array { return [new EncryptionKey(Common::HKDF($this->config['hash'], $key->getRawBytes(), $this->getKeySize(), Common::KEYSPLIT_ENCRYPT, $salt), Common::DRIVER_SODIUM), new AuthenticationKey(Common::HKDF($this->config['hash'], $key->getRawBytes(), Common::safeStrlen(\hash($this->config['hash'], '', true)), Common::KEYSPLIT_AUTH, $salt), Common::DRIVER_SODIUM)]; }
/** * Split a key (i.e. master key -> encryption key, authentication key) * * @return Key[] */ public function splitSymmetricKey(Key $key, string $salt) : array { return [new EncryptionKey(Common::HKDF('blake2b', $key->getRawBytes(), \Sodium\CRYPTO_STREAM_KEYBYTES, Common::KEYSPLIT_ENCRYPT, $salt), Common::DRIVER_SODIUM), new AuthenticationKey(Common::HKDF('blake2b', $key->getRawBytes(), \Sodium\CRYPTO_AUTH_KEYBYTES, Common::KEYSPLIT_AUTH, $salt), Common::DRIVER_SODIUM)]; }