C # uses the ellipse signature algorithm to make the software serial number

Source: Internet
Author: User
Tags hash

Elliptic curve cryptography (elliptic curve cryptography, abbreviated as ECC) is a method of public-key cryptography based on elliptic curve mathematics. The use of elliptic curves in cryptography was proposed by Neal Koblitz and Victor Miller respectively in 1985.

The elliptic signature algorithm should be first used by Microsoft in software protection, we usually use the 25-bit serial number is based on the elliptic signature algorithm. In theory, the elliptic signature algorithm is difficult to crack, because ... (omitted, interested to see "ECC Encryption Algorithm Introduction" this article). But because of the length of the serial number of Microsoft, the length of the signature is only 62bit (how much, forget), so the private key can be calculated violently. That's how we used the counting device.

Defined:

Elliptic Curve ep= (p,a,b,g,n,h)

P, A, b are used to determine the curve, G is the basis, N is the order of point G, H is the integral part of the number m and N of all points on the elliptic curve.

Signature process

1, select an Elliptic Curve EP (A,B), and the base point G

2, select the private key K (K<n,n for G), and use the base g to compute the public key k=kg

3, take a random integer R (r<n), and compute the point R=RG

4, compute the characteristic information and the hash value of R, i.e. Hash=sha (data,x,y)

5, Calculate sig≡r-hash*k (mod n)

6, using SIG and hash to generate serial numbers (for example, using BASE24 encoding)

Verification process

1, extract the sig and hash from the serial number

2, Calculate r≡sig*g+hash*k (mod p)

3, compute the characteristic information and the hash value of R, i.e. H=sha (data,x,y)

4, compare H and Hash

In fact, the above process is elliptic Curve DSA (ECDSA).

Well, anyway, how do we use the Ellipse signature algorithm in C #?

In. Net3.5, Microsoft provides the Ecdsacng class, but the limitation is that it must be used on Vista systems, and Microsoft's implementation has previously determined the parameters of the elliptic curve (ecdsap256,ecdsap384,ecdsap521), and I They have no way of using their own parameters. About the use of the Ecdsacng class, has been introduced, MSDN also has instructions. What I want to say here is how to use the third party class library.

The third party encryption class library introduced here is Bcccrypto (http://www.bouncycastle.org/csharp/), now the version is 1.4, tested more stable.

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.