Avatar of Marthaj
MarthajFlag for United States of America

asked on 

PHP encrypted string and passing to a ASP Page

I have a PHP page in which i need to pass values as an encrypted string to a asp page.
Creating the string is not a problem, but will ASP be able to decode it??
Any advice/help is appreciated...
PHPASPEncryption

Avatar of undefined
Last Comment
Marthaj
Avatar of Big Monty
Big Monty
Flag of United States of America image

Yes, you would use Server.HTMLDecode( str)
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Depends on how you encrypt it, but generally speaking, yes. There are dozens of ways to encrypt data, so it largely depends on you encrypting things correctly and matching the same crypto settings on the ASP side. The more common encryption techniques are AES-128 or AES-256 nowadays, but that is not the whole list by any means.

I'm less familiar with classic ASP, but if you're talking about ASP.NET, then you should have all the major cryptographic engines and ciphers available to you.

Big Monty mentions HTMLDecode, but that has nothing to do with encryption. HTMLDecode is used to decode HTML-encoded strings. Encoding/decoding is NOT the same as encryption/decryption.

Encoding/decoding is like putting data into an envelope and sending it through the post office. It's a way of "packaging" up some data temporarily for transport, but it has absolutely no security.

Encryption/decryption is putting data into a locked safe.

You might want to use encrypt the data first, and THEN encode it in a certain fashion. If you have a big chunk of data, you'd probably be better off using Base64 encoding on the data after encrypting and then POST-ing the encoded data to the ASP page. The ASP page would then base64-decode the data, and then subsequently decrypt it back to its original form.

When you POST the data, just use application/x-www-form-urlencoded as your content-type header and pass in a variable name and the URL-encoded version of your Base64 chunk. ASP should be able to recognize that as a normal form POST.
Avatar of Marthaj
Marthaj
Flag of United States of America image

ASKER

Does this work for encoding in base-64? I am not sure I need to go that strongly on encoding. Your thoughts?
Avatar of Marthaj
Marthaj
Flag of United States of America image

ASKER

I see what you are saying gr8gonzo and your comment is helpful. What I want is to encrypt it, send in a quertystring to an asp page.
And I am not sure of my footing here. I know how to encrypt/decrypt in PHP, extract data from quertystrings in ASP, but I am concern that the asp page will not be able to extract it correctly and unsure on how to code it.
So what you are saying, and it makes sense, that if I use AES-128 (or AES-256) on sending end, I need to use it one the receiving page. Makes sense.
SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Are you dealing with ASP.NET or classic ASP?
Avatar of Marthaj
Marthaj
Flag of United States of America image

ASKER

I am using PHP v5.6  page to a Classical ASP.  Mcrypt is depreciated in PHP 5.5 and removed in PHP 7.0.0
I am not sure at all on my approach, and what is best so your guidance is much appreciated.
Avatar of Big Monty
Big Monty
Flag of United States of America image

As far as i know, and I just did a quick search) there is no equivalent of PHP's mcrypt function. Are you tied to that algorithm, or can you use a more universal encryption algorithm? If you can move to SHA256, then there are asp libraries of they're which will handle the actual encryption / decryption functions
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Marthaj
Marthaj
Flag of United States of America image

ASKER

Thank you all for responding. A lof of information/thoughts to digest, but good information. Let me have a day to review/research/experiment with and see what the results will be.
More in a day.
Avatar of Marthaj
Marthaj
Flag of United States of America image

ASKER

I thank all of you....when I am able to return to the section of coding that I am working on, I will let you folks know how it went...:}
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo