views:

101

answers:

1

Hi,

I need to retrieve a result from a mysql database using a user defined function that recreates the following PHP code -

$signature = urlencode(base64_encode((hash_hmac("sha1", utf8_encode($string_to_sign), awsSecretKey, TRUE))));

Are UDF's up to the job? What are the security implications for storing the AWS secret key in the UDF / passing this as a variable?

Ideally I want to be able to do this -

$sql = "SELECT file_type, myPHPfunctionToSignFilename(file_name) ..."
$result = mysql_query($sql)
return ($result)

But I think myPHPfunctionToSignFilename needs to be MYSQL-UDF-FUNCTION...

Any suggestions?

Thanks

Stephen

A: 

Why do you want to do this in the database? Performance or some other reason? I don't think it'll matter in the former case.

Bart van Heukelom