473,410 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

FormsAuthentication to PHP

I'm trying to make my PHP scripts communicate with a ASP.NET based
authentication solution.

I have $_COOKIE["FormsAuth"], but it's encrypted using the
FormsAuthentication.Encrypt method.

This is the example code showing the encryption:
http://dev.bd0.net/test/formsauth.txt

Is there a way to decrypt this cookie using PHP?

Here's an overview of FormsAuthentication methods in ASP.NET for those
who are curious:
<http://msdn2.microsoft.com/en-us/lib...ity.formsauthe
ntication_methods.aspx>

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Sep 20 '06 #1
2 2797
Kim André Akerĝ wrote:
I'm trying to make my PHP scripts communicate with a ASP.NET based
authentication solution.

I have $_COOKIE["FormsAuth"], but it's encrypted using the
FormsAuthentication.Encrypt method.

This is the example code showing the encryption:
http://dev.bd0.net/test/formsauth.txt

Is there a way to decrypt this cookie using PHP?

Here's an overview of FormsAuthentication methods in ASP.NET for those
who are curious:
<http://msdn2.microsoft.com/en-us/lib...ity.formsauthe
ntication_methods.aspx>
Hi, Kim,

If you knew the algorithm they used for doing the encryption you could.
But without that you don't stand much chance. And unfortunately, I
don't seen any of the gory details on that page.

I did a quick google search to see if I could come up with anything
about how they do it, but didn't find anything. I guess someone would
have to reverse engineer the code - which would be difficult, but not
impossible.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 20 '06 #2
NC
Kim André Akerĝ wrote:
>
I'm trying to make my PHP scripts communicate with
a ASP.NET based authentication solution.

I have $_COOKIE["FormsAuth"], but it's encrypted using
the FormsAuthentication.Encrypt method.
FormsAuthentication.Encrypt produces a serialized
FormsAuthenticationTicket object...
Is there a way to decrypt this cookie using PHP?
Yes, but only on Windows. You'll have to define a COM or a DOTNET
object and decrypt the cookie the Windows way, using
FormsAuthentication.Decrypt...

A much simpler solution would be to tweak with the ASP.Net code and
have it explicitly set cookies based on FormsAuthenticationTicket
properties (CookiePath, Expiration, Expired, IsPersistent, IssueDate,
Name, UserData, Version). Something along these lines:

Dim cookie As HttpCookie
cookie = New HttpCookie("Expiration")
cookie.Value = authTicket.Expiration.ToString
Response.Cookies.Add(cookie)

Then, instead of dealing with the serialized object in
$_COOKIE["FormsAuth"], you would be dealing with plain and simple
$_COOKIE['Expiration'].

My guess is that about the only value you really need is Expiration...

Cheers,
NC

Sep 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tommy | last post by:
I want to encrypt the values of my cookies. I found out that I could create a FormsAuthenticationTicket, and use the FormsAuthentication.Encrypt method to encrypt the cookie. However, I do not...
2
by: George Durzi | last post by:
When you call FormsAuthentication.SignOut(), is the FormsAuthentication cookie supposed to be destroyed automatically? I'm creating my FormsAuthentication cookie by doing: HttpCookie oCookie =...
3
by: Phil Certain | last post by:
Hi I'm building a site that has publicly available pages and password protected pages. Publicly available pages reside in: /public and password protected pages reside in: /private
2
by: Grant Merwitz | last post by:
Hi, i am using forms authentication in an ASP.NET project I am setting the Forms authentication cookie by using: FormsAuthentication.RedirectFromLoginPage(UserName.Text, false); Now when i...
4
by: Matthias S. | last post by:
Hi there, I've created an application which is using Forms-based authentification. My Login-Button event handler looks somewhat like this: // validate the input, etc... // sUserName holds now...
1
by: Dean R. Henderson | last post by:
I setup FormsAuthentication on a couple websites where it has been working as expected for a long time. I used this code to setup the same type of authentication on a new website I am working on...
5
by: Ċženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
8
by: Bill Henning | last post by:
Another developer and I have noticed that after upgrading to the ASP.NET 2.0 RTM release, when using: FormsAuthentication.SetAuthCookie(userName, true) That the cookie is no longer persisted,...
3
by: Noremac | last post by:
My google skills must be dwindling. I am trying to determine how in ASP.NET 2.0 I can get the ReturnUrl querystring variable in Forms Authentication to contain the absolute url. Just like others...
0
by: Rodrigo m. Ferreira | last post by:
Can you help me to solve the following problem? on my loggin page I have the code: protected void LoginButton_Click(object sender, EventArgs e) { if(Membership.ValidateUser(TXTUsuario.Text,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.