Re: Hardcoding RijndaelManaged Keys

From: moondaddy (moondaddy_at_nospam.com)
Date: 03/13/04

  • Next message: Bill Coan: "Re: Word 2003: Smart tags and .NET security and trust all installed addins and templates"
    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
    > >
    > >
    > >
    >
    >
    

  • Next message: Bill Coan: "Re: Word 2003: Smart tags and .NET security and trust all installed addins and templates"

    Relevant Pages

    • Re: RSA implementation, please comment.
      ... SYNOPSIS: Is Crypt::RSA secure acceptable in open source if the ... The client asked me to devise "a secure way to save credit card ... I don't know if I can talk you out of keeping the card numbers on the same server but I'm going to try. ... If you must store the data on the same web server, then you are better off generating an encryption key from a good quality random number generator and using a two way algorithm like RC4. ...
      (comp.lang.perl.misc)
    • Re: Encryption Question
      ... encryption, but then the problem is, how do I decrypt it on the server ... get your public key as a javascript string and send to client, ... holding back the private on the server. ... javascript based method to work in a truly secure fashion, ...
      (comp.lang.javascript)
    • RE: PGP email encryption
      ... There IS a web client to PGP, and one way to use "email encryption" in PGP ... is to have the PGP server catch the ... > someone receives a notification that a secure email message has been sent ...
      (Security-Basics)
    • Re: data security
      ... The secure server works in conjunction with your web browser to ... How secure is this encryption method? ... using a secured server to do their Internet banking, webmail, etc. ...
      (alt.computer.security)
    • [NT] Multiple Vulnerabilities in HP Web JetAdmin (Read, Write, Execute, Path Disclosure, Password De
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... HP Web JetAdmin is an enterprise management system for large amounts of HP ... The web server is a modular service ... HP Web JetAdmin uses it's own encryption. ...
      (Securiteam)

    Loading