Posted on Categories:Cryptography, 密码学, 数学代写

# 数学代写|密码学代写Cryptography Theory代考|Setting up RSA

avatest™

## avatest™帮您通过考试

avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试，包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您，创造模拟试题，提供所有的问题例子，以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试，我们都能帮助您！

•最快12小时交付

•200+ 英语母语导师

•70分以下全额退款

## 数学代写|密码学Cryptography Theory代考|Setting up RSA

All the real work in RSA occurs during key generation. This should not be surprising since the ‘clever’ part of any public-key cryptosystem is in designing a relationship between two keys which allows one to reverse the effect of the other, while allowing one of them to be publicly known. Note we do not have to be quite so mathematically clever when generating symmetric keys, which ‘just’ requires an ability to randomly generate numbers (see Section 8.1). The wider issues associated with key generation are discussed in more detail in Section 10.3.
GENERATING AN RSAKEYPAIR
We are now ready to generate an RSA key pair. The ‘we’ in this case is anyone who is setting up an RSA key pair. This could be someone generating a key pair for themselves, or a trusted key centre generating a key pair for a client. If we wish to set up a network of users who may want to communicate with one another using RSA, then every user in the network will need to run this key pair generation process, or have the trusted key centre run it for them. We proceed as follows:

Generating the modulus. Let $n$ be the product of two large primes $p$ and $q$. In other words, let $n=p q$. By large, we typically mean a minimum of 512 bits long, preferably even longer. Thus, $p$ and $q$ are very large primes, and $n$ is an even larger number. Finding primes of this size is not straightforward, but there are known processes for generating them. The number $n$ produced in this step is usually referred to as an RSA modulus.

Generating $e$. We select a ‘special’ number $e$. The number $e$ cannot be just any number. For example, it must be greater than 1 and less than $(p-1)(q-1)$. The precise mathematical property that $e$ must have is there must be no numbers dividing neatly into $e$ and into $(p-1)(q-1)$ except for 1 . The mathematical term for this property is that $e$ and $(p-1)(q-1)$ are coprime. Consider the following simple example:

• Let $p=3$ and $q=7$. In this case, $(p-1)(q-1)=2 \times 6=12$. Any suitable choice of $e$ must have the property there are no numbers neatly dividing into $e$ and 12 , except for 1.
• $e=2$ is no good, since 2 is a factor of both 2 and 12. For a similar reason, we canalso rule out all multiples of 2 , namely, $e=4, e=6 \cdot e=8$, and $e=10$.
• $e=3$ is no good, since 3 is a factor of both 3 and 12. For a similar reason, we can also rule out all multiples of 3 , namely, $e=6$ and $e=9$
• The remaining choices are $e=5, e=7$, and $e=11$. Since in each case there is no number dividing into these choices of $e$ and 12 , other than 1 , all these choices of $e$ are valid.
Unlike in this ‘toy’ example, for the sizes of $p$ and $q$ we tend to use in real RSA implementations, we will find many numbers less than $(p-1)(q-1)$ which have the right property to be used as $e$.

## 数学代写|密码学Cryptography Theory代考|Generating the private key

Generating the private key. We compute the private key $d$ from $p, q$, and $e$. The private key $d$ is uniquely determined by the public key $(n, e)$, meaning that given an $n$ and an $e$, there can only ever be one possible value $d$. This is essentially the clever part of RSA, since it is the mathematical relationship between $e$ and $d$ which makes RSA work. We thus have to be precise about how to find this value $d$.

In mathematical terminology, the private key $d$ is the inverse of e modulo $(p-1)(q-1)$ (see the Mathematics Appendix for more details). What this means is that $d$ is the unique number less than $(p-1)(q-1)$ which, when multiplied by $e$, is equal to 1 modulo $(p-1)(q-1)$. Written mathematically (which is much simpler), this relationship is expressed by:
$$e d=1 \bmod (p-1)(q-1) .$$
It is sufficient just to accept that, if we choose $e$ correctly, such a $d$ exists and is unique. Conveniently, there is a simple algorithm to compute $d$. This algorithm is known as the Extended Euclidean Algorithm, which takes as input $p, q$, and $e$, and outputs $d$. The Extended Euclidean Algorithm can be computed in polynomial time by anyone who knows $p$ and $q$. However, anyone who does not know $p$ and $q$ cannot run it to find $d$. This is why it is important that $n=p q$ is difficult to factor. If $n$ was easy to factor, then an attacker could compute $p$ and $q$ and then run the Extended Euclidean Algorithm to obtain $d$.

It is worth providing an example of RSA key generation, just to make sure the process is clear. This example will, of course, use numbers which are far too small to be used in practice. Just keep in mind that the primes we use are just six bits long, rather than the thousands of bits long often recommended for RSA implementations.

## 数学代写|密码学Cryptography Theory代考|Setting up RSA

RSA中所有的实际工作都发生在密钥生成过程中。这并不奇怪，因为任何公钥密码系统的“聪明”之处在于设计两个密钥之间的关系，允许一个密钥反转另一个密钥的效果，同时允许其中一个密钥被公开。注意，在生成对称密钥时，我们不需要在数学上如此聪明，这只需要随机生成数字的能力(参见8.1节)。与密钥生成相关的更广泛的问题将在第10.3节中更详细地讨论。

$e=2$ 不行，因为2是2和12的因数。出于类似的原因，我们也可以排除2的所有倍数，即$e=4, e=6 \cdot e=8$和$e=10$。

$e=3$ 不行，因为3是3和12的因数。出于类似的原因，我们也可以排除3的所有倍数，即$e=6$和 $e=9$

## 数学代写|密码学Cryptography Theory代考|Generating the private key

$$e d=1 \bmod (p-1)(q-1) .$$

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。