فروشگاه گلد گیم

Ethereum: How can I get the uncompressed public key from the compressed public key in openssl?

Following the inappropriate Key out of the Smooth Closed Key in OpenSSL

At the work with cryptographic keys, eSpecialless with the cryptostemy elliptic kriva (ECC), such as ecdsa, it is important to pony, as the unwanted open key from the smoothly key. In this state, we will upate in the process and the sight of the code fragment, the use of the openssl library.

Sedable Format Closed key

The Format of the Crushed Key, Used by Keys ECC, Based on the Key Structure Curve2519, which is of a Few Flights:

  • EC_Point: Eliptic pole.

  • Base_string: Baza Stack, Conducted Songs Opened Key (Shakes Up).

  • Dlin

Sedable Format Open Key

Ethereum: How can I get the uncompressed public key from the compressed public key in openssl?

The Unspecified Format of the Open Key, But The Second Basin Is Used And There Is Some Calculation:

  • EC_Point: Everything Eliliptic Point Are.

  • Base_string: Baza Strike, containing inappropriately open key (he will be Overhelmed).

  • Dlin

Following the unscrupulous open key out of the cried key

In order to fade the inappropriate key, you need to unpack the closed key, using the ecdk ‘openssl library. This is the base64 -in the stretch, which can be decoded for the adhesive key.

Here's the Primmer Code Fragments in C ++:

CPP

#include

#include

#include

Int main () {

// Download file from the file or buffer

Ec_key* pkey = null;

Int retr = ec_key_new_by_curve_name (nid_secp256k, null);

If (ret! = 0) {

STD :: Cerr << "Loading Key" << STD :: Endl;

Apract 1;

}

// Refund the boiled key

Unsigned Char* Base64ENC = NULL; // Your False Key here

RET = Base64_Dode (Base64ENC, NULL);

If (ret! = 0) {

STD :: CERR << "Decompress Part of the Part" << STD :: Endl;

Ec_Key_Free (Pkey);

Apract 1;

}

Int len ​​= string ((char*) base64ENC); // revet the dlin of the basic stroke

Unsigned Char* Uncressedbase64 = New Unexed Char [len];

RET = Base64_Dode (Uncpressedbase64, Null, Len);

If (ret! = 0) {

STD :: CERR << "Decompress Part of the Part" << STD :: Endl;

Run [] Base64ENC; // do not forget to remember!

Ec_Key_Free (Pkey);

Apract 1;

}

/

Unsigned Char* Publoiche = Null;

RET = ECDP_Key_From_Bytes (& Publicationy, Uncpressedbase64, Len);

If (ret! = 0) {

STD :: Cerr << "The Closed Key in the Open Key" << STD :: Endl;

Run [] Base64ENC; // do not forget to remember!

Ec_Key_Free (Pkey);

Apract 1;

}

// Pass the inappropriate Key

Unsigned Char* Pubstr = New Unsigned Char [256]; // Train Most for the Storts

RET = ECDP_PUB_KEY_TO_ST (Publicationy, Pubstr, 256);

If (ret! = 0) {

STD :: CERR << "Dressing the open key in string" << STD :: Endl;

Run [] Base64ENC; // do not forget to remember!

Ec_Key_Free (Pkey);

Apract 1;

}

// Free all submitted memory

Run [] Base64ENC;

Run [] Uncressedbase64;

Run [] Publickey;

STD :: Cout << "Understandable Opened Key:" << Pubstr << STD :: Endl;

// pick -Up key (in this one not obligatory)

Ec_Key_Free (Pkey);

Avairats 0;

}

Obraty Unimania That You Need to Change Base64ENC on Your Factory Covered Key.

Primer Wariants

This fracture of the code is a demonstration of the one, as a fate of the inaccurate open key from the covered key with the openssl.

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

فیلدهای نمایش داده شده را انتخاب کنید. دیگران مخفی خواهند شد. برای تنظیم مجدد سفارش ، بکشید و رها کنید.
  • عکس
  • شناسه محصول
  • امتیاز
  • قیمت
  • در انبار
  • موجودی
  • افزودن به سبد خرید
  • توضیحات
  • محتوا
  • عرض
  • اندازه
  • تنظیمات بیشتر
برای مخفی کردن نوار مقایسه، روی آن کلیک کنید
مقایسه