1.1 Secure MCC Melody MDFU Client Library – Generating Key Pairs

This document describes how the public and private p256 keys were generated for the 8-bit Secure MDFU Client Library.

The are many possible ways to generate a p256 key pair. One of the easiest ways is to use OpenSSL®. OpenSSL® is an open-source cryptographic software library and toolset that implements the SSL and TLS protocols, providing functions for secure communications and general-purpose cryptography.

  1. This command generates a new Elliptic Curve (EC) private key using the prime256v1 curve and saves it to the ec_private_key.pem file.
    openssl ecparam -name prime256v1 -genkey -noout -out ec_private_key.pem
    
    • openssl ecparam: OpenSSL command for working with elliptic curve parameters
    • -name prime256v1: Specifies the name of the elliptic curve to use. prime256v1 is a commonly used curve, also known as secp256r1.
    • -genkey: Tells OpenSSL to generate an EC private key using the specified curve
    • -noout: Prevents the output of the encoded version of the parameters to the screen
    • -out ec_private_key.pem: Specifies the output file for the generated private key, in this case, ec_private_key.pem
  2. This command extracts the public key from the previously generated EC private key and saves it to the ec_public_key.pem file.
    openssl ec -in ec_private_key.pem -pubout -out ec_public_key.pem
    
    • openssl ec: OpenSSL command for processing EC private keys
    • -in ec_private_key.pem: Specifies the input file containing the EC private key
    • -pubout: Tells OpenSSL to output the corresponding public key
    • -out ec_public_key.pem: Specifies the output file for the public key, in this case, ec_public_key.pem