Oh, I just knew the problem. In Lua, we can not create keys from this source.
A_PRIVATE_KEY="w2UwuwmF9h5p02fnr3MkxtKoDTl8aTtJXqLbsPwbqPg="
B_PRIVATE_KEY="ZyoPMal0TZzNwDyUUE30iThXCKgPOthPaIN2qnOhkNs="
So, these syntaxes are wrong.
local a_key = openssl_pkey.new({
type = "EC",
params = {
private = a_bn,
group = "prime256v1"
}
})
local b_key = openssl_pkey.new({
type = "EC",
params = {
private = b_bn,
group = "prime256v1"
}
})
These AI-suggested syntaxes are also wrong.
local a_key = openssl_pkey.new({
type = "X25519",
curve = "prime256v1",
private_key = a_decoded_key,
})
We need to convert the source to the PEM keys first. So, the correct source would be like this.
A_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_CONTENT_HERE\n-----END PRIVATE KEY-----"
B_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_CONTENT_HERE\n-----END PRIVATE KEY-----"
Then, the correct Lua syntax would be like this.
local a_key = openssl_pkey.new(a_private_key)
local b_key = openssl_pkey.new(b_private_key)