- Generate Ed25519 private key.
openssl genpkey -algorithm ED25519 -out ed25519.key
- Convert to C bytes array.
./pem-to-c.sh ed25519.key
Example output:
#define _PUBKEY _b653c2afa57d511f
static const unsigned char _b653c2afa57d511f[] = {
/* 0000000 */ 0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00, 0x2a, 0x5c, 0x90, 0x18,
/* 0000020 */ 0x01, 0x29, 0x58, 0xd4, 0x1f, 0x13, 0x64, 0x93, 0xa1, 0x54, 0x80, 0x13, 0x96, 0x77, 0x5a, 0x0f,
/* 0000040 */ 0xdf, 0xf7, 0x5b, 0x15, 0x17, 0xfb, 0x4d, 0x4f, 0x20, 0x5e, 0x4f, 0x12,
/* 0000054 */
};
#define _PRIVKEY _7a88403e83fa8560
static const unsigned char _7a88403e83fa8560[] = {
/* 0000000 */ 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x04, 0x22, 0x04, 0x20,
/* 0000020 */ 0x49, 0x72, 0x57, 0xc7, 0x9c, 0x74, 0xe4, 0x1f, 0xdd, 0xee, 0x42, 0x50, 0xb8, 0x1d, 0x40, 0x1f,
/* 0000040 */ 0x4a, 0xd4, 0x3b, 0x8f, 0x29, 0x70, 0x05, 0x7e, 0x13, 0x2e, 0x37, 0xcb, 0x9c, 0x68, 0xa1, 0xcb,
/* 0000060 */
};