Re: Hardcoding RijndaelManaged Keys
From: moondaddy (moondaddy_at_nospam.com)
Date: 03/13/04
- Previous message: Shawn Farkas: "RE: Hardcoding RijndaelManaged Keys"
- In reply to: Shawn Farkas: "RE: Hardcoding RijndaelManaged Keys"
- Next in thread: Michael Giagnocavo [MVP]: "Re: Hardcoding RijndaelManaged Keys"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 13 Mar 2004 01:44:41 -0600
Thanks Shawn, I appreciate the advice and will look into your suggestions.
-- moondaddy@nospam.com ""Shawn Farkas"" <shawnfa@online.microsoft.com> wrote in message news:dKfxidKCEHA.600@cpmsftngxa06.phx.gbl... > Hardcoding keys into your application is not a very secure solution at all. It's far too easy to crack open the app, and remove the keys. > However, before addressing that, let me answer your other questions. > > > I was wanting to hardcode the private and public keys on both sides > > Let me clarify here -- RijndealManaged is an implementation of the AES encryption algorithm, which is a symmetric algorithm. There are no public > / private keys with a symmetric algorithm, just a single key that both parties must have. If you're looking for an algorithm that would use public and > private keys (asymetric), then I suggest using RSA. > > >Does the Key and IV have to be generated each time data is encrypted, or can I simply generate them once > > The key and IV must be the same on both the server and the client, otherwise there is no possible way for the server to decrypt the client's data. > > > is there another wait to achieve this like using some sort of certificate signature on both sides? > > Signatures and encryption solve two different problems. Encryption makes it difficult for untrusted parties to read your data. Signatures don't do > this, instead they make it difficult for untrusted parties to modify your data. You may need both properties, in which case you'll need to combine > encryption and digital signatures. > > > If I don't do it the way explained above, then it seems that in order to send some secure data from the client to the server, the client needs to first > request a public key from the server, then encrypt the data using this public key and send the encrypted data to the server which results in 2 round > trips and also passing a key around. > > This is probably a better method of achieving what you want to do than hardcoding your key into a client application. If the key is hardcoded, all a > hacker needs to do is get a copy of your client binary, and your entire security model just got removed. > > What I might suggest is distributing the key seperately to each of the few people who need access to it. Then have a utility application that uses > DPAPI to store the key in their machines. This is probably the most secure method of achieving what you're attempting to do. > > Another (albiet less desirable method) would work if your environment is very controlled (which it sounds like it is). If that's the case, I might > suggest placing the key in a known location under very strict ACLs. This way its not coded into the binary, and the client and server both can > access it. > > > Key management is a very difficult area of cryptography, and it is one of the most critical. Before you begin implimenting a solution, I suggest you > do some reading up on the topic. I'd start with Michael Howard and David LeBlanc's Writing Secure Code, Second edition. They have a chapter > on key management. I'd also look up some information on DPAPI and see if you can't use that to solve your problem. > > -Shawn > http://blogs.msdn.com/shawnfa > > -- > > This posting is provided "AS IS" with no warranties, and confers no rights. > Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they > originated. > -------------------- > >From: "moondaddy" <moondaddy@nospam.com> > >Subject: Hardcoding RijndaelManaged Keys > >Date: Thu, 11 Mar 2004 13:49:31 -0600 > >Lines: 37 > >X-Priority: 3 > >X-MSMail-Priority: Normal > >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 > >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 > >Message-ID: <uPLs7H6BEHA.3848@TK2MSFTNGP11.phx.gbl> > >Newsgroups: microsoft.public.dotnet.security > >NNTP-Posting-Host: adsl-66-137-118-19.dsl.hstntx.swbell.net 66.137.118.19 > >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl > >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.security:5350 > >X-Tomcat-NG: microsoft.public.dotnet.security > > > >I have a vb.net WinForms app using web services which needs to send secure > >data back and forth to the server. This app will not be widely used and > >only a few people will have access to it. > > > >I was wanting to hardcode the private and public keys on both sides so I > >wouldn't have to be sending any keys across the wire. I generate the keys > >like this: > > > >Dim myRijndael As New RijndaelManaged > >myRijndael.GenerateKey() > >myRijndael.GenerateIV() > >'Get the key and IV. > >key = myRijndael.Key > >IV = myRijndael.IV > > > >Does the Key and IV have to be generated each time data is encrypted, or can > >I simply generate them once, write them to an output, and then hardcode them > >into variables on both the server and the client app. If this isn't > >possible or is really wrong, then is there another wait to achieve this like > >using some sort of certificate signature on both sides? > > > >Obviously I'm new at this and need some guidance. If I don't do it the way > >explained above, then it seems that in order to send some secure data from > >the client to the server, the client needs to first request a public key > >from the server, then encrypt the data using this public key and send the > >encrypted data to the server which results in 2 round trips and also passing > >a key around. If the key were intercepted, then a 'hacker' could use this > >key to encrypt his own parameters or data and send that to the server which > >the server could then decrypt and posibly use such as inserting a new user > >and password which they could then use to hack access into the app. > > > >Thanks. > > > >-- > >moondaddy@nospam.com > > > > > > > >
- Previous message: Shawn Farkas: "RE: Hardcoding RijndaelManaged Keys"
- In reply to: Shawn Farkas: "RE: Hardcoding RijndaelManaged Keys"
- Next in thread: Michael Giagnocavo [MVP]: "Re: Hardcoding RijndaelManaged Keys"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
Loading