function verify_file_signature( $filename,
$signatures,
$filename_for_errors = false
) { if ( !
$filename_for_errors ) { $filename_for_errors =
wp_basename( $filename );
} // Check we can process signatures.
if ( !
function_exists( 'sodium_crypto_sign_verify_detached'
) || !
in_array( 'sha384',
array_map( 'strtolower',
hash_algos() ), true
) ) { return new WP_Error( 'signature_verification_unsupported',
sprintf( /* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.'
),
'<span class="code">' .
esc_html( $filename_for_errors ) . '</span>'
),
( !
function_exists( 'sodium_crypto_sign_verify_detached'
) ? 'sodium_crypto_sign_verify_detached' : 'sha384'
) );
}