Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1071103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:40:02+00:00 2026-05-16T20:40:02+00:00

EDIT 1 : I think I was not clear myself before and hence could

  • 0

EDIT 1 : I think I was not clear myself
before and hence could not word it
better. So, I am creating a system
where I am providing page content to
another system via IFRAMEs. A user
will login to the other system and
that system will set their apiKey and
userKey in a cookie on my system so
that access will be granted into my
system. I want to encrypt these values
so that a malicious user cannot be
granted access into someone elses
sytem by modifying a value. Are there
good .NET standards for this type of
encryption/security? What do you
recommend I do in this scenario?

Hi all,
Firstly this might be asked before but I have never implemented hashing or encryption before so I just want to make sure that I put my point across clearly.I want to have some good idea of what needs to be done here.

I have couple of keys which are unique to the users and are being passed by client through the iframes and to maintain session we create cookies using these values for them.So, now I want encrypt or generate a hash for these values since they are visible in the url I dont want the users manipulating these values.

So, I guess I want to generate a hash for both the keys and display that in the browser in order to stop the users from entering some random values and try to abuse the system. I guess would store these hashed values in the database and then compare with original values.

Please just anyone guide me to the steps what all I need to do and what should I be using to achieve it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:40:03+00:00Added an answer on May 16, 2026 at 8:40 pm

    Firstly if I understand your scenario correctly you don’t need a hash but you need an encryption of those keys. If you hash them you will never be able to read the original values back and create the session cookie. You are trying to implement a cross domain Single-Sign-On (if this is not your case and I misunderstood your scenario you could ignore the rest of my answer).

    I would recommend you using the machine keys to encrypt/decrypt:

    Encrypt:

    var ticket = new FormsAuthenticationTicket(
        1, // version
        "ticketName", // name of the ticket (it doesn't really matter here)
        DateTime.Now, // issue date
        DateTime.Now.AddMinutes(1), // validity of the ticket
        false, // should the ticket be persistent
        "key1=value1&key2=value2......" // values to encrypt, could be any string
    );
    string encrypted = FormsAuthentication.Encrypt(ticket);
    

    Now send the encrypted string over the wire and on the other hand decrypt. It is important to perform this over an encrypted channel using SSL to avoid a Man-In-The-Middle who can steal the encrypted value and try to brute force it:

    var ticket = FormsAuthentication.Decrypt(encrypted);
    if (!ticket.Expired)
    {
        // The ticket hasn't expired (< 1min) => use the values
        string keys = ticket.UserData;
        // TODO: Parse and issue cookie
    }
    

    For this to work it is necessary to have the same machine keys on both the encrypting and the decrypting side.


    UPDATE:

    Here are the steps:

    1. The user is authenticated on System A (Domain 1)
    2. System A decides to include in an iframe System B (Domain 2) where the user is not authenticated
    3. System A generates an encrypted string containing user information using machine keys
    4. System A sends to System B (via the src property of the iframe) this encrypted value
    5. System B reads and decrypts the encrypted value containing the user information
    6. System B issues an authentication cookie to indicate that the user is now authenticated on Domain 2
    7. System B shows the authenticated content to the user

    You have achieved cross domain single sign on. Of course this technique is not limited to iframes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code like belows. This works but I think it's not clear
I think my eclipse's ctrl+clicking links might benefit greatly... Edit: I'm using eclipse PDT.
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
Let me make this clear, I am NOT using a cms nor a blogging
Is there any thing in PHP to create basic scaffold, like in Rails? EDIT:
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.