// Numbas version: finer_feedback_settings {"name": "El Gamal Encryption", "extensions": ["numbertheory", "elliptic-curves"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "El Gamal Encryption", "tags": [], "metadata": {"description": "

The purpose of this question is to test student's understanding of the Elliptic curves version of El Gamal encryption. It asks them to go through two steps: the publication of the public key, and the use of this public key to encrypt a message.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

Alice and Bob decide to use El Gamal on the Elliptic curve $\\var{curve}$. They agree to use the point $P=\\var{P}$.

", "advice": "

Alice's public key

\n

Alice's public key is $n_A P$, where $n_A$ is the private key. So, here she calculates $A = \\var{na}\\cdot\\var{p} = \\var{AlicePublic}$.

\n

Bob's message

\n

Bob uses the one-time password $k=\\var{k}$. He will use it to encrypt his message.

\n

Bob sends the message $(c_1,c_2)$, where $c_1 = kP = \\var{k}\\cdot \\var{P} = \\var{c1}$, and $c_2=kA = \\var{k}\\cdot\\var{AlicePublic} = \\var{c2}$.

", "rulesets": {}, "extensions": ["elliptic-curves", "numbertheory"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"m": {"name": "m", "group": "Alice", "definition": "random(primelist(20,100))", "description": "

We are working in $\\mathbb{Z}_m$.

", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Alice", "definition": "1", "description": "

cubic coefficient of the elliptic curve.

", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Alice", "definition": "random(-10..10)", "description": "

linear coefficient of the elliptic curve.

", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Alice", "definition": "random(-10..10 except 0)", "description": "

constant coefficient of the elliptic curve.

", "templateType": "anything", "can_override": false}, "curve": {"name": "curve", "group": "Alice", "definition": "curve(a,b,c,m)", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Alice", "definition": "random(getpoints(curve))", "description": "

A point on the curve that will be part of the key.

", "templateType": "anything", "can_override": false}, "q": {"name": "q", "group": "Alice", "definition": "order(p)", "description": "

The order of p. We want this number to be moderately large.

", "templateType": "anything", "can_override": false}, "na": {"name": "na", "group": "Alice", "definition": "random(2..q-1)", "description": "

Alice's private key.

", "templateType": "anything", "can_override": false}, "AlicePublic": {"name": "AlicePublic", "group": "Alice", "definition": "na*p", "description": "

Alice's public key.

", "templateType": "anything", "can_override": false}, "Message": {"name": "Message", "group": "Bob", "definition": "random(getpoints(curve))", "description": "

Plain text message sent by Bob.

", "templateType": "anything", "can_override": false}, "k": {"name": "k", "group": "Bob", "definition": "random(2..q-1)", "description": "

Bob's one-time password.

", "templateType": "anything", "can_override": false}, "c1": {"name": "c1", "group": "Bob", "definition": "k*P", "description": "

First part of Bob's encrypted message.

", "templateType": "anything", "can_override": false}, "c2": {"name": "c2", "group": "Bob", "definition": "(k*AlicePublic)+Message", "description": "

Second part of Bob's encrypted message.

", "templateType": "anything", "can_override": false}, "MessageDecrypt": {"name": "MessageDecrypt", "group": "Ungrouped variables", "definition": "c2-(na*c1)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "q<> Infinity and q>2 and q<10", "maxRuns": 100}, "ungrouped_variables": ["MessageDecrypt"], "variable_groups": [{"name": "Alice", "variables": ["m", "a", "b", "c", "curve", "p", "q", "na", "AlicePublic"]}, {"name": "Bob", "variables": ["Message", "k", "c1", "c2"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Alice's Public key", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Alice's private key is $\\var{na}$. As part of her public key, what point on the curve does Alice publish? ([[0]],[[1]])

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "x", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(AlicePublic,'x')", "maxValue": "get(AlicePublic,'x')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "y", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(AlicePublic,'y')", "maxValue": "get(AlicePublic,'y')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Bob's Encrypted Message", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Bob wants to send the message $M=\\var{Message}$ using the one-time key $k=\\var{k}$. What message does Bob send Alice?

\n

[([[0]],[[1]]),([[2]],[[3]])].

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "x1", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(c1,'x')", "maxValue": "get(c1,'x')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "y1", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(c1,'y')", "maxValue": "get(c1,'y')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "x2", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(c2,'x')", "maxValue": "get(c2,'x')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "y2", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(c2,'y')", "maxValue": "get(c2,'y')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}]}]}], "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}]}