%%% CS 134 Homework
%%% Spring 2019

\documentclass[12pt]{article}
\usepackage{enumerate}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{afterpage}
\usepackage[margin = .75in]{geometry}
%%% Import any packages here. %%%



\newcommand{\Name}[1]{\noindent \textbf{Full Name:} #1 \\}
\newcommand{\Sources}[1]{\noindent \textbf{Sources:} #1 \\}
\newcommand{\Problem}[2]{\mbox{} \newline \noindent \textbf{\textbf{Problem #1: #2   \\}}}
\newcommand{\Homework}[1]{\noindent \textbf{Homework #1} \\}
\newcommand{\Due}[1]{\noindent \textbf{Due:} #1 \\}
\newcommand{\Statement}[1]{\noindent  #1  \hrule ~\\~\\}
\newcommand{\Answer}{\noindent \textbf{Solution:} }
\newcommand{\ID}[1]{\noindent \textbf{UCI ID Number:} #1 \\}
\newcommand{\Guidelines}{
~\\
\textbf{Guidelines: }
\begin{itemize}
\item Use any word processor (or handwrite and scan your answers). Upload your solutions \textbf{in PDF} to Gradescope.
\item No collaboration is allowed. The only people you may consult are the TA-s and the instructor.
\item Looking up, paraphrasing or copying answers from the Internet or other sources is not allowed;
doing so is a violation of academic honesty. You must cite any sources you use, e.g., reference books, Wikipedia, etc.
\end{itemize}
\textbf{Warning:} any submissions not following the above guidelines will receive a score of zero.
}
\newcommand{\Points}{
\begin{table}[!ht]
\centering
\begin{tabular}{| l | l | l | l | l | l |}
\hline
P1  & P2  & P3  & P4  & P5  & Total \\
\hline
~~~/30 & ~~~/10 & ~~~/30 & ~~~/10 & ~~~/20 & ~~~/100 \\
\hline
\end{tabular}
\end{table}
}

%%% Define any new commands here. %%%%

%%% End commands. %%%%%%%%%%%%%%%

\begin{document}

	\begin{center}
	\bf
	Fall 2019 \\	CS134: Computer and Network Security\\
	\Homework{2}
	\Due{11/20/19: 11:59pm}
	\end{center}


%%% Fill in your name, ID number, and sources here. %%%
\Name{} 
\ID{}
\Sources{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Guidelines
\Points
\pagebreak

\Problem{1}{RSA}
\Statement{
Assume the following RSA parameters:

\begin{align*}
    p = 7, q = 17, d = 35, c = 9
\end{align*}

\begin{enumerate}[label=(\alph*)]
    \item Use Chinese Remainder Theorem to find the value of plaintext $m$. Show your work.
    \item Use Extended Euclidean Algorithm to find the value of public exponent $e$. Show your work.
\end{enumerate}

\noindent \textbf{NOTE:} Be sure to show your steps clearly. Just showing $m$ and $e$ will be result in zero points.
	\\
}
\Answer
%%%% Your answer here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%

\pagebreak % Delete this line.
%%%%%%%%%%%%%%%%%%%%%%

\Problem{2}{Zero-Knowledge with Fizz and Buzz}
\Statement{
You and Alice have stumbled upon two unlabeled bottles of lemonade and a bunch of empty cups. Alice insists that the bottles contain the same type of lemonade, but you know better: you know by taste that one is Fizz and the other Buzz. How could you prove to your friend that lemonades are different, without revealing which is Fizz and which is Buzz? You may assume that the bottles of lemonade will never run out.

\vspace{1em}
}
\Answer
%%%% Your answer here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%

\pagebreak % Delete this line.
%%%%%%%%%%%%%%%%%%%%%%

\Problem{3}{Randomness in ElGamal}
\Statement{
Suppose that, instead of choosing $r$ completely at random in ElGamal public key encryption, a lazy encryptor (Alice) derives it by following $r^\prime = 2r$. Suppose also that Eve knows that Alice had encrypted the same message $m$ with the two random numbers $r$ and $r^\prime = 2r$, thus creating two ciphertexts $\{ k,~c \}$ and $\{ k^{\prime},~c^{\prime} \}$. Answer the following questions.
\begin{enumerate}[label=(\alph*)]
    \item Show how Eve can derive the message $m$ using the two ciphertexts and the public key provided by Alice. Recall that $y = b^{x} \bmod p,~k = b^{r} \bmod p,~c = m \times y^{r} \bmod p$.
    \item Show that the attack you have shown in part (a) will work by using the following numbers: $p = 11,~b = 2,~x = 3,~m = 7,~r = 2$.
\end{enumerate}

	\\
}
\Answer
%%%% Your answer here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%

\pagebreak % Delete this line.
%%%%%%%%%%%%%%%%%%%%%%

\Problem{4}{Randomness in Fiat-Shamir}
\Statement{
Recall that in the Fiat-Shamir identification protocol, the prover (\textit{Prv}) chooses a random number $R$ each time \textit{Prv} wants to prove his identitiy to the verifier (\textit{Ver}). Explain what happens if \textit{Prv} reuses $R$ and \textit{Ver} somehow knows about it. Will it enable \textit{Ver} to obain any information regarding \textit{Prv}'s secret key $S$? Why or why not? Justify your answer.\\

\noindent \textbf{NOTE:} Answer to the problem in 3 to 5 lines (including the justification). An answer without a justification will result with an automatic 0.
	\\
}
\Answer
%%%% Your answer here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%

\pagebreak % Delete this line.
%%%%%%%%%%%%%%%%%%%%%%

\Problem{5}{Access Control}
\Statement{Consider a small company that is implementing access control policies on its internally shared files. There are 1500 employees in the company, and 20,000 files initially. The allowed actions on the files are Read (R), Write (W), Execute (E), and Delete (D). On average, 100 files are created every week, each with fewer than 100 employees having access.  
\begin{enumerate}[label=(\alph*)]
    \item Show or describe what an access control matrix would look like for this system.
   \item Show or describe what an access control list would look like for this system.
   \item In terms of storage, would an access control matrix or access control list be better in this system? Why?
   \item Would an ACM or ACL be better in terms of file access time for the employees? (i.e., the time required for the system to check if an employee is authorized to perform an action on a file) Why?
  
\end{enumerate}

\noindent \textbf{NOTE:} Limit your answers to five lines each (but you may draw diagrams for parts (a) and (b)). For (a) and (b) you may assume all employees only have read (R) access to all files for simplicity.\\
}
\Answer
%%%% Your answer here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
\end{document}