Kamrul Fardaus
Kamrul Fardaus

Reputation: 31

How to Secure iframe source

I have a web application where i have call some asp pages link in iframe. I want to hide source URL with parameter .Because the URL and parameter Data is confidential. I just want to hide the iframe source . I don't use inspect element disable JavaScript , because using firebug we can easily see the URL source. Please help me.

Upvotes: 0

Views: 3079

Answers (1)

pendo
pendo

Reputation: 842

Can't help you with ASP.NET, but I can show you what I'd do with PHP and hopefully that will lead you down the right path.

<?php
//contents of the file that includes the iframe
$password = "foo";  //set your password
$key = 123456;  //this is the id that your iframe needs
$encryptedString = openssl_encrypt($key, "AES-128-ECB",$password);  //encrypt the string
?>
<!-- output the iframe and pass the token as a $_GET variabl a la str=$encryptedString -->
<iframe src="iframegenerator.php?str=<?php echo $encryptedString; ?>" />

Now here is the iframegenerator.php page

//iframe code
$password = "foo";  //set your password
$encryptedString = $_GET['str'];  //get the str variable
$decryptedString = openssl_decrypt($encryptedString,"AES-128-ECB",$password); //decrypt it
echo $decryptedString;  //spit out the contents

Make sure you use a strong password, obviously not foo.

Upvotes: 1

Related Questions