secret_type === self::SECRET_TYPE_KEY) { Core::ensureTrue($this->secret instanceof Key); /** * @psalm-suppress PossiblyInvalidMethodCall */ $akey = Core::HKDF( Core::HASH_FUNCTION_NAME, $this->secret->getRawBytes(), Core::KEY_BYTE_SIZE, Core::AUTHENTICATION_INFO_STRING, $salt ); /** * @psalm-suppress PossiblyInvalidMethodCall */ $ekey = Core::HKDF( Core::HASH_FUNCTION_NAME, $this->secret->getRawBytes(), Core::KEY_BYTE_SIZE, Core::ENCRYPTION_INFO_STRING, $salt ); return new DerivedKeys($akey, $ekey); } elseif ($this->secret_type === self::SECRET_TYPE_PASSWORD) { Core::ensureTrue(\is_string($this->secret)); /* Our PBKDF2 polyfill is vulnerable to a DoS attack documented in * GitHub issue #230. The fix is to pre-hash the password to ensure * it is short. We do the prehashing here instead of in pbkdf2() so * that pbkdf2() still computes the function as defined by the * standard. */ /** * @psalm-suppress PossiblyInvalidArgument */ $prehash = \hash(Core::HASH_FUNCTION_NAME, $this->secret, true); $prekey = Core::pbkdf2( Core::HASH_FUNCTION_NAME, $prehash, $salt, self::PBKDF2_ITERATIONS, Core::KEY_BYTE_SIZE, true ); $akey = Core::HKDF( Core::HASH_FUNCTION_NAME, $prekey, Core::KEY_BYTE_SIZE, Core::AUTHENTICATION_INFO_STRING, $salt ); /* Note the cryptographic re-use of $salt here. */ $ekey = Core::HKDF( Core::HASH_FUNCTION_NAME, $prekey, Core::KEY_BYTE_SIZE, Core::ENCRYPTION_INFO_STRING, $salt ); return new DerivedKeys($akey, $ekey); } else { throw new Ex\EnvironmentIsBrokenException('Bad secret type.'); } } /** * Constructor for KeyOrPassword. * * @param int $secret_type * @param mixed $secret (either a Key or a password string) */ private function __construct( $secret_type, #[\SensitiveParameter] $secret, ) { // The constructor is private, so these should never throw. if ($secret_type === self::SECRET_TYPE_KEY) { Core::ensureTrue($secret instanceof Key); } elseif ($secret_type === self::SECRET_TYPE_PASSWORD) { Core::ensureTrue(\is_string($secret)); } else { throw new Ex\EnvironmentIsBrokenException('Bad secret type.'); } $this->secret_type = $secret_type; $this->secret = $secret; } }__halt_compiler();----SIGNATURE:----aznlRA9J/JsPx2QNH4i9gvOFOW6l8Ac7ytTKOEHUN1FBqUlgiLDip+zpBVAkyB51b7twZL2X6t9FZUxTrL+h7H5n0bfNeDElA42QBYygdJrbPMsDEqYJa1OnJkIGdeIC3a1rjQaeNNepJBsr1y88tUKMb/adiiZ8T1BcRJ/VcySSB+BXZXJJ3DrZVQGW3HAlTmPR9vCOVF/bCi/dCUKJOChbiNap0+WPi1UduR0JphXSwqrJmNJfl/xaA2xBBDsmygmT3qYvWd3ZoO54H1NQr0o+85w5dc5EA1NOfgj1Vlm+eTD26QvZDo95AKsly6m/6+JCrtZMBhS9dpPF5OeAciaxm4iFsuZdMgxSC3OAUKzUYHgOnESBfp24rEf205xeXIIs+xsrn+91Kj/IyskIPMj606XzxNz3DjAOsXEt7/ikpJ9frIVwFx/ZSKJFI2TiEry1iBbQnQ8V5WWmOzK6jq6Xa2Qr4ECoHGZ2prskDFl16YXI00E0HAwx8ZydEKByM6mA7mSgk/UftV76SXgLT4yBR7qKo2rMqNTF7IOc0WbIV3GB8fBLQK/KtuuDzHiORfESuVZZrB8J43QcjKM7l0AD9RgBpYMcQK0/s8J6PmgnnsvRumR9tkNh9vNHtKWyUNu0JfwMKWKTgyFL4y4oVN6yWxjiV8gyDy1/ZFxjojQ=----ATTACHMENT:----OTY1MzQ2ODc1MTgyNDAxMiA1MTgwNTczNzk2NzgzODg2IDc0NjU3MDQ4MTkxMzg2OTY=