RSA Algorithm-MSDN Documentation

Source: Internet
Author: User
Tags modulus

RSA algorithm

To generate a key pair, you can start by creating two large prime numbers named P and Q. Multiply these two numbers, and the result is called N. because both P and Q are prime numbers, the full factor of n is 1, p, Q, and N.

If only the number less than n is considered, the number of numbers with n Inma (that is, no common factor with N) equals (p-1) (q-1).

Now, select a number e, which is calculated with a value of Inma. the public key is represented as {e, n}.

To create a private key, you must calculate D, which is a number that satisfies (d) (e) mod n = 1. According to the Euclidean algorithm, the private key is {d, n}.

the encryption of plain text m to cipher text C is defined as C = (m ^ e) mod N. decryption is defined as m = (c ^ d) mod N.

Field Summary

The PKCS #1 on the RSA Laboratories website: The a.1.2 section of the RSA Cryptography Standard (PKCS #1: RSA encryption Standards) defines the format of the RSA private key.

The following table summarizes the fields of the rsaparameters structure. The third column provides the corresponding fields in the a.1.2 section of the PKCS #1: RSA Cryptography Standard (PKCS #1: RSA encryption standards).

RSAParameters Field

Contains

Corresponding PKCS #1 fields

D

D, private key index

Privateexponent

Dp

d MoD (p-1)

Exponent1

Dq

d MoD (q-1)

Exponent2

Exponent

E, public key index

Publicexponent

Inverseq

(INVERSEQ) (q) = 1 mod p

Coefficient

Modulus

N

Modulus

P

P

Prime1

Q

Q

Prime2

The security of RSA is based on the fact that given the public key {e, n}, whether it is calculated directly or by factoring N to p and Q, it is not feasible to calculate d. Therefore, any key part related to D, p, or Q must be kept confidential.

RSA Algorithm-MSDN Documentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.