1
$\begingroup$

I'm building a Digital Examination system and I'm having problems understanding some concepts in cryptography.

I want use to Asymetric Cryptography and my questions are

  1. Do I encrypt the entire file?

    When I do my encryption is it that I should make the entire file encrypted with the private key of the sender of the exam? (as it passes through different hands e.g. lecturer to exam department)

    Or do I just generate some kind of code that the recepient would compare it to? Is that what digital signing is?

  2. Do I need a public and private key for every party the exam passes through?

    (lecturer, student, exam dept etc)

$\endgroup$
2
  • 4
    $\begingroup$ I'm pretty sure, the answer is "it depends". Who is allowed to see the exam? Who is allowed to modify it? How relevant are intermediate copies? Does the whole history of the exam needs to be (verifieably) reconstructible? What is your threat model (i.e. who are the bad guys and what can they do to achieve what?)? $\endgroup$
    – SEJPM
    Commented Feb 16, 2016 at 21:39
  • 4
    $\begingroup$ I'm pretty sure, if you have to ask such basic questions, that putting together a secure system is outside your capabilities. No offense, but constructing such a complicated system is tricky; the devil is in the details, and there's a surprising number of devils in this one. A rather lot of specialized expertise is required; perhaps there's someone at your school that can help? $\endgroup$
    – poncho
    Commented Feb 16, 2016 at 21:50

1 Answer 1

2
$\begingroup$

Let's see if we can clear up some of the basic crypto concepts for you. (Though you should probably do a bunch more reading on your own, and maybe hire a crypto consultant if this system is more than just a course project. Sloppily done crypto can get an institution into big legal trouble.)

Public Key Encryption:

In public key encryption, you encrypt something with the recipient's public key, so that the recipient can decrypt it with their private key. Think of it like a mail slot in your front door: anybody can send you stuff by slipping it through the slot (ie encrypt with public key), but only the person who lives there can unlock the door and get it (ie decrypt with the private key). -- The idea of "encrypting with the private key of the sender" does not make any sense - you push it out the mail slot so anybody walking by your porch can look at it?

For your second question:

2.Do I need a public and private key for every party the exam passes through? (lecturer, student, exam dept etc)

If you want all of those people to be able to read it, then yes, you will need to issue each of them keypairs and have a system like this:

Person A encrypts for person B --> Person B decrypts then re-encrypts for person C --> Person C decrypts then re-encrypts for person D --> etc

(Note that a scheme like this would be considered insecure in any other setting because any of those people could modify the exam before re-encrypting it, and there's no way to prove who changed it. So this likely isn't what you want either.)

System design:

In my opinion, the proper way to do this would be to assign every student a keypair - maybe attached to their user account? Or maybe every exam invigilator gets a keypair if that makes more sense. Then your central server encrypts N copies of the exam: one per student / invigilator. If there are intermediary people who need to see it (lecturer, dept, etc) then you make a copy encrypted for their keypair also. This way, once you encrypt a copy of the exam for Student X, then regardless of how many hands it passes through, only Student X will be able to open it. This is the type of usage that Public-Key encryption is designed for. (As a side note: this would work very well if each copy of the exam had a random number embedded in it so you know that Student X is handing in their copy of the exam, not their friend's copy.)

Edit:

Looking over your question again, the line

Or do I just generate some kind of code that the recepient would compare it to? Is that what digital signing is?

doesn't fit with the rest of your question. Signatures are an anti-tamper system: they guarantee that this is the original document, and hasn't been modified, but does nothing to hide it (ie everybody can see the text).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.