P1024.C the analysis of the DH algorithm in OpenSSL open source program

Source: Internet
Author: User

#include <stdio.h>#include <openssl/bn.h>#include <openssl/asn1.h>#include <openssl/dh.h>#include <openssl/pem.h>/*8*16*8=1024,1024 represents the key length (number of binary digits) */unsigned CharData[] = {0x97,0xf6,0x42,0x61,0xCA,0xb5,0x05,0xDD,0x28,0x28,0xe1,0x3F,0x1D,0x68,0xb6,0xd3,0xDB,0xD0,0xf3,0x13,0x04,0x7F,0x40,0xe8,0x56,0xDA,0x58,0xCB,0x13,0xb8,0xa1,0xBF,0x2B,0x78,0x3A,0x4C,0x6d,0x59,0xd5,0xf9,0x2A,0xFC,0x6c,0xFF,0x3d,0x69,0x3F,0x78,0xb2,0x3d,0x4f,0x31,0x60,0xa9,0x50,0x2e,0x3e,0xFA,0xf7,0xAB,0x5E,0x1A,0xd5,0xa6,0x5E,0x55,0x43,0x13,0x82,0x8d,0xa8,0x3B,0x9F,0xF2,0xd9,0x41,0xDE,0xe9,0x56,0x89,0xFA,0xDA,0xEA,0x09,0x36,0xAD,0xDF,0x19,0x71,0xFE,0x63,0x5b,0x20,0xAF,0x47,0x03,0x64,0x60,0x3C,0x2D,0xE0,0x59,0xf5,0x4B,0x65,0x0A,0xd8,0xFA,0x0C,0xf7,0x01,0x21,0xC7,0x47,0x99,0xD7,0x58,0x71,0x32,0xBE,0x9b,0x99,0x9b,0xb9,0xb7,0x87,0xe8,0xAB,};main () {DH *dh; DH = dh_new ();//Construct a new DH structureDh->p = bn_bin2bn (data,sizeof(data), NULL);//Converts the positive integer of the size bit in data to a large number, and the large number returnsDh->g = Bn_new ();//Newborn into a bignum structureBn_set_word (Dh->g,2);//dh->g=2Pem_write_dhparams (stdout, DH);//write out the DH parameter}

P1024.C the analysis of the DH algorithm in OpenSSL open source program

Related Article

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.