Modifying SE05X Library on Arduino Portenta C33 for Custom Crypto Key Generation (SECP256K1)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Modifying SE05X Library on Arduino Portenta C33 for Custom Crypto Key Generation (SECP256K1)

936件の閲覧回数
MaxMustermann84
Contributor I

I'm working with an Arduino Portenta C33 and am facing a challenge related to its integrated SE05X security element. The current SE05X library allows for the generation of ECCurve_NIST_P256 key pairs (https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/SE05X/examples/SE05XPrivateKey/SE...), but I need to generate a key pair using the SECP256K1 curve. Does anyone have example code or tips on how to solve this problem?

/*
  SE05X Private Key

  This sketch uses the SE05X to generate a new EC NIST P-256 keypair
  and store it with id 999, then the public key is printed in DER format.

  Circuit:
   - Portenta C33
*/

#include <SE05X.h>
#include <Wire.h>

void printBufferHex(const byte input[], size_t inputLength) {
  for (size_t i = 0; i < inputLength; i++) {
    Serial.print(input[i] >> 4, HEX);
    Serial.print(input[i] & 0x0f, HEX);
  }
  Serial.println();
}

void setup() {
  Serial.begin(9600);
  while (!Serial);

  if (!SE05X.begin()) {
    Serial.println("Failed to communicate with SE05X!");
    while (1);
  }

  const int KeyId = 999;
  byte derBuf[256];
  size_t derSize;

  SE05X.generatePrivateKey(KeyId, derBuf, sizeof(derBuf), &derSize);
  printBufferHex(derBuf, derSize);
}

void loop() {

  
}

 

ラベル(1)
0 件の賞賛
返信
1 返信

908件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @MaxMustermann84 ,

 

I think you have to find the curve type definition in the SE05X Library on Arduino Portenta C33 and change it from ECCurve_NIST_P256 to ECCurve_SECP256K1. Please kindly refer to the following for more details.

Kan_Li_0-1706781065805.png

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 件の賞賛
返信