7

I want to know if my method of encryption can ensure the security of my data if my database was hacked as well as the authenticity of the data I am decrypting. I am using GnuPG's implementation of the OpenPGP encryption standard.

I have a web application that is situated on 'Server A' where users can submit information via a form. When they submit the form the following encryption process takes place:

Encryption - Server A

  1. Form data is encrypted using the public key of server B
  2. Form data is signed using the private key of server A

Admin users of the website can see the submitted data via another web application situated on 'Server B' where the decryption process takes place:

Decryption - Server B

  1. Form data is verified using the public key of server A
  2. Form data is decrypted using private key of server B

Thanks

2
  • 1
    Is the web app secured using SSL? If not, you cannot guarantee that what the user submitted is actually what you are encrypting and signing as it could be tampered with inbetween. Other than that, the setup looks pretty good.
    – mikeazo
    Nov 17, 2011 at 16:16
  • @mikeazo Thank you for your response. The web app is secured using SSL.
    – Imran Azad
    Nov 17, 2011 at 17:00

1 Answer 1

7

The encryption and signature processes which take place on server A and server B protect the form data against unwanted eavesdropping and malicious (or accidental) alteration, from the moment they were encrypted/signed on server A, to the moment they are decrypted/verified on server B. This includes any kind of storage on A or B, and whatever transport medium is used between A and B. But note the following:

  • The encryption and signature say nothing about the data submitted by the client; as @mikeazo suggests in a comment, the submission process had better be protected as well.

  • Thanks to the signature, B can be sure that any message it received is "genuine" (it is really as it was when A signed it). However, B cannot know if he got all the messages; signatures say nothing about message which B never saw because the attacker intercepted them before delivery to B.

  • The signature covers only that which is signed, not any metadata that may be associated with it. For instance, the form data can be verified to relate to a given user only if the name of that user is part of the form data. Otherwise, an attacker would be free to swap encrypted forms around in A's database. Similarly, an attacker hacking is way between A and B could replay old encrypted message, so B cannot be sure that he got "the latest" form data for a given user unless that form data includes some kind of time stamp or sequence number.

  • Security is only relative to the secrecy of the involved private keys. It takes a bit of faith to believe that an attacker gaining access to A's database will not have access to A's private key.

So while your encryption+signature system does offer some useful guarantees, they may fail to cover everything that envisioned attackers may try. I invite you to formally write down, somewhere, the extent of the powers that you grant to the supposed attackers (that's the "attack model").

Apart from that, using GnuPG is a very good idea, in that using a homemade implementation, or, worse, a homemade protocol, would be a very bad idea.

2
  • Many thanks, I really appreciate your answer. When you say 'powers that you grant to the supposed attackers', what do you mean by 'powers'? Could you give me a few examples please? Thank You.
    – Imran Azad
    Nov 17, 2011 at 17:09
  • @Imran: you must decide what an attacker "can do": whether he can eavesdrop on a link, whether he can add and/or remove data on a link, what kind of extra access he can get on either server (database read, database write, complete system read including all private key files...). There is no protection which can hold against an attacker who can do "everything" (i.e. you cannot beat God with crypto) so you have to define what kind of non-omnipotent attacker you face. Nov 17, 2011 at 17:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .